Reset ActionText::Content.renderer before and after each request

This commit is contained in:
George Claghorn 2019-01-05 16:59:54 -05:00
parent f99b3c5f97
commit 02d2958b6c
1 changed files with 6 additions and 3 deletions

View File

@ -34,13 +34,16 @@ module ActionText
end
end
initializer "action_text.renderer" do
initializer "action_text.renderer" do |app|
app.executor.to_run { ActionText::Content.renderer = ApplicationController.renderer }
app.executor.to_complete { ActionText::Content.renderer = ApplicationController.renderer }
ActiveSupport.on_load(:action_text_content) do
self.renderer ||= ApplicationController.renderer
self.renderer = ApplicationController.renderer
end
ActiveSupport.on_load(:action_controller_base) do
before_action { ActionText::Content.renderer = ActionText::Content.renderer.new(request.env) }
before_action { ActionText::Content.renderer = ApplicationController.renderer.new(request.env) }
end
end
end