From 40f79da8f22d301f87873669d7355346049eccf2 Mon Sep 17 00:00:00 2001 From: Kasper Timm Hansen Date: Sat, 30 May 2015 23:11:49 +0200 Subject: Make digest cache work in development. Avoid computing the same fragment digest many times when looping over templates. The cache is cleared on every request so template changes are still picked up. --- actionview/lib/action_view/railtie.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'actionview/lib/action_view/railtie.rb') diff --git a/actionview/lib/action_view/railtie.rb b/actionview/lib/action_view/railtie.rb index 5dc7950d6b..e829d86c99 100644 --- a/actionview/lib/action_view/railtie.rb +++ b/actionview/lib/action_view/railtie.rb @@ -42,6 +42,14 @@ module ActionView end end + 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 + initializer "action_view.setup_action_pack" do |app| ActiveSupport.on_load(:action_controller) do ActionView::RoutingUrlFor.include(ActionDispatch::Routing::UrlFor) -- cgit v1.2.3