aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_text/engine.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2018-04-13 16:09:39 -0700
committerDavid Heinemeier Hansson <david@loudthinking.com>2018-04-13 16:09:39 -0700
commit0bb72a4cda9ddeabcb1357a3ac41aef01057f82b (patch)
tree126de620fa68c58845b24053688792e177302a62 /lib/active_text/engine.rb
parent491bee6e64863f2dc6e8d1f59829e61d4a8c86ad (diff)
downloadrails-0bb72a4cda9ddeabcb1357a3ac41aef01057f82b.tar.gz
rails-0bb72a4cda9ddeabcb1357a3ac41aef01057f82b.tar.bz2
rails-0bb72a4cda9ddeabcb1357a3ac41aef01057f82b.zip
Relieve the need for having to manually set a before_action in ApplicationController
Diffstat (limited to 'lib/active_text/engine.rb')
-rw-r--r--lib/active_text/engine.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/active_text/engine.rb b/lib/active_text/engine.rb
index c11bb7cce9..aac0c57881 100644
--- a/lib/active_text/engine.rb
+++ b/lib/active_text/engine.rb
@@ -32,6 +32,13 @@ module ActiveText
initializer "active_text.config" do
config.after_initialize do |app|
ActiveText.renderer ||= ApplicationController.renderer
+
+ # FIXME: ApplicationController should have a per-request specific renderer
+ # that's been set with the request.env env, and ActiveText should just piggyback off
+ # that by default rather than doing this work directly.
+ ApplicationController.before_action do
+ ActiveText.renderer = ActiveText.renderer.new(request.env)
+ end
end
end
end