diff options
author | Daniel Schierbeck <dasch@zendesk.com> | 2013-07-15 15:59:18 +0200 |
---|---|---|
committer | Daniel Schierbeck <dasch@zendesk.com> | 2013-09-19 10:25:14 +0200 |
commit | 77e79ecd92acd43a282566e5d297b8e74dc14f05 (patch) | |
tree | b0b10448930bd2a4a8d2effb2e75cc1d7287c49a /actionview/lib/action_view | |
parent | cb8174c57f46f3b11bc4662638539f45677d7dc1 (diff) | |
download | rails-77e79ecd92acd43a282566e5d297b8e74dc14f05.tar.gz rails-77e79ecd92acd43a282566e5d297b8e74dc14f05.tar.bz2 rails-77e79ecd92acd43a282566e5d297b8e74dc14f05.zip |
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.
Diffstat (limited to 'actionview/lib/action_view')
-rw-r--r-- | actionview/lib/action_view/digestor.rb | 5 |
1 files changed, 4 insertions, 1 deletions
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 |