From 77e79ecd92acd43a282566e5d297b8e74dc14f05 Mon Sep 17 00:00:00 2001 From: Daniel Schierbeck Date: Mon, 15 Jul 2013 15:59:18 +0200 Subject: Bust the template digest cache key when details are changed Since the lookup details will influence which template is resolved, they need to be included in the cache key -- otherwise two different templates may erroneously share the same digest value. --- actionview/lib/action_view/digestor.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'actionview/lib') diff --git a/actionview/lib/action_view/digestor.rb b/actionview/lib/action_view/digestor.rb index 95c3200c81..af158a630b 100644 --- a/actionview/lib/action_view/digestor.rb +++ b/actionview/lib/action_view/digestor.rb @@ -10,7 +10,10 @@ module ActionView class << self def digest(name, format, finder, options = {}) - cache_key = ([name, format] + Array.wrap(options[:dependencies])).join('.') + details_key = finder.details_key.hash + dependencies = Array.wrap(options[:dependencies]) + cache_key = ([name, details_key, format] + dependencies).join('.') + # this is a correctly done double-checked locking idiom # (ThreadSafe::Cache's lookups have volatile semantics) @@cache[cache_key] || @@digest_monitor.synchronize do -- cgit v1.2.3