From ee84079768b619784a8e9b98084f263173ed10eb Mon Sep 17 00:00:00 2001 From: Gonzalo Rodriguez Date: Fri, 22 Jun 2018 19:10:35 -0300 Subject: [PATCH] Fix 'redis is not part of the bundle' exception when using :memory_store When RedisCacheStore constant is referenced, activesupport autoloads and rails tries to require redis, throwing exception if not present --- lib/rack/attack/store_proxy/redis_cache_store_proxy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rack/attack/store_proxy/redis_cache_store_proxy.rb b/lib/rack/attack/store_proxy/redis_cache_store_proxy.rb index f99de36..d6cbdfb 100644 --- a/lib/rack/attack/store_proxy/redis_cache_store_proxy.rb +++ b/lib/rack/attack/store_proxy/redis_cache_store_proxy.rb @@ -5,7 +5,7 @@ module Rack module StoreProxy class RedisCacheStoreProxy < SimpleDelegator def self.handle?(store) - defined?(::ActiveSupport::Cache::RedisCacheStore) && store.is_a?(::ActiveSupport::Cache::RedisCacheStore) + defined?(::Redis) && defined?(::ActiveSupport::Cache::RedisCacheStore) && store.is_a?(::ActiveSupport::Cache::RedisCacheStore) end def increment(name, amount = 1, options = {})