diff options
Diffstat (limited to 'actionview/lib/action_view/railtie.rb')
-rw-r--r-- | actionview/lib/action_view/railtie.rb | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/actionview/lib/action_view/railtie.rb b/actionview/lib/action_view/railtie.rb index c2783f6377..e829d86c99 100644 --- a/actionview/lib/action_view/railtie.rb +++ b/actionview/lib/action_view/railtie.rb @@ -36,21 +36,30 @@ module ActionView end end - initializer "action_view.setup_action_pack", before: :add_view_paths do |app| + initializer "action_view.collection_caching" do |app| ActiveSupport.on_load(:action_controller) do - ActionController::Base.superclass.send(:include, ActionView::Layouts) - ActionView::RoutingUrlFor.send(:include, ActionDispatch::Routing::UrlFor) + PartialRenderer.collection_cache = app.config.action_controller.cache_store end end - initializer "action_view.setup_action_mailer", before: :add_view_paths do |app| - ActiveSupport.on_load(:action_mailer) do - ActionMailer::Base.send(:include, ActionView::Layouts) + initializer "action_view.per_request_digest_cache" do |app| + ActiveSupport.on_load(:action_view) do + if app.config.consider_all_requests_local + app.middleware.use ActionView::Digestor::PerRequestDigestCacheExpiry + end end end - rake_tasks do - load "action_view/tasks/dependencies.rake" + initializer "action_view.setup_action_pack" do |app| + ActiveSupport.on_load(:action_controller) do + ActionView::RoutingUrlFor.include(ActionDispatch::Routing::UrlFor) + end + end + + rake_tasks do |app| + unless app.config.api_only + load "action_view/tasks/dependencies.rake" + end end end end |