Open bibendi opened 1 month ago
config/initializers/flipper.rb
# frozen_string_literal: true
require "active_support/cache"
require "flipper/adapters/active_record"
require "flipper/adapters/active_support_cache_store"
require "flipper/adapters/redis_cache"
FLIPPER_ID_STRUCT = Struct.new(:flipper_id)
Flipper.configure do |config|
redis_adapter = Flipper::Adapters::RedisCache.new(
Flipper::Adapters::ActiveRecord.new,
PRIMARY_REDIS,
900 # ttl in seconds - 15 minutes
)
config.adapter do
Flipper::Adapters::ActiveSupportCacheStore.new(
redis_adapter,
ActiveSupport::Cache::MemoryStore.new,
1.minute
)
end
end
Looks like this was a side-effect of #832.
In you initializer you can wrap things in
ActiveSupport.on_load(:active_record) do
# flipper config here
end
Not sure if there's a better callback to hook into, but that got me working.
Hey!
I got an error after I upgraded flipper-active_record from v1.3.0 to v1.3.1