From 77b9677b053250d3ea7de8a358022ba9d9ad8dc0 Mon Sep 17 00:00:00 2001 From: Timothy Cardenas <tim@mancrates.com> Date: Sat, 14 Mar 2020 08:09:25 -0700 Subject: [PATCH] fix: rails 6 deprecation warnings with autoloader --- lib/flipflop/engine.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/flipflop/engine.rb b/lib/flipflop/engine.rb index b9fe2ab..c237b65 100644 --- a/lib/flipflop/engine.rb +++ b/lib/flipflop/engine.rb @@ -43,8 +43,14 @@ class Engine < ::Rails::Engine initializer "flipflop.request_interceptor" do |app| interceptor = Strategies::AbstractStrategy::RequestInterceptor - ActionController::Base.send(:include, interceptor) - ActionController::API.send(:include, interceptor) if defined?(ActionController::API) + + ActiveSupport.on_load(:action_controller_base) do + ActionController::Base.send(:include, interceptor) + end + + ActiveSupport.on_load(:action_controller_api) do + ActionController::API.send(:include, interceptor) + end end def run_tasks_blocks(app)