Sha256: fac421fed392d0ff737f7fad2a9f6ca39ea7e0b78be03044cac23e09d083fe5e
Contents?: true
Size: 784 Bytes
Versions: 16
Compression:
Stored size: 784 Bytes
Contents
if defined?(Redis) && defined?(Redis::Namespace) begin tmp_rds = Redis::Namespace.new("#{Rails.application.class.parent_name}::active_page", redis: Redis.new(url: ENV.fetch('REDIS_URL') { 'redis://localhost:6379/1' })) tmp_rds.get('test') rescue if (!Rails.env.production? && !Boolean.parse(ENV.fetch('FORCE_REDIS') { false })) || Boolean.parse(ENV.fetch('ALLOW_FAKE_REDIS') { false }) require BetterRecord::Engine.root.join('lib', 'better_record', 'fake_redis') puts "WARNING!!! Redis Server not found" tmp_rds = BetterRecord::FakeRedis.new else raise end end Rails.application.class.parent.const_set('REDIS', tmp_rds) module Rails def self.redis Rails.application.class.parent.const_get('REDIS') end end end
Version data entries
16 entries across 16 versions & 1 rubygems