diff options
Diffstat (limited to 'actionview/lib/action_view/digestor.rb')
-rw-r--r-- | actionview/lib/action_view/digestor.rb | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/actionview/lib/action_view/digestor.rb b/actionview/lib/action_view/digestor.rb index b99d1af998..f3c29d663c 100644 --- a/actionview/lib/action_view/digestor.rb +++ b/actionview/lib/action_view/digestor.rb @@ -4,14 +4,7 @@ require 'monitor' module ActionView class Digestor - @@digest_mutex = Mutex.new - - class PerRequestDigestCacheExpiry < Struct.new(:app) # :nodoc: - def call(env) - ActionView::LookupContext::DetailsKey.clear - app.call(env) - end - end + @@digest_mutex = Mutex.new class << self # Supported options: @@ -22,7 +15,7 @@ module ActionView # * <tt>partial</tt> - Specifies whether the template is a partial def digest(name:, finder:, dependencies: []) dependencies ||= [] - cache_key = ([ name ].compact + dependencies).join('.') + cache_key = [ name, finder.rendered_format, dependencies ].flatten.compact.join('.') # this is a correctly done double-checked locking idiom # (Concurrent::Map's lookups have volatile semantics) @@ -46,8 +39,12 @@ module ActionView def tree(name, finder, partial = false, seen = {}) logical_name = name.gsub(%r|/_|, "/") - if finder.disable_cache { finder.exists?(logical_name, [], partial) } - template = finder.disable_cache { finder.find(logical_name, [], partial) } + options = {} + options[:formats] = [finder.rendered_format] if finder.rendered_format + + if finder.disable_cache { finder.exists?(logical_name, [], partial, [], options) } + template = finder.disable_cache { finder.find(logical_name, [], partial, [], options) } + finder.rendered_format ||= template.formats.first if node = seen[template.identifier] # handle cycles in the tree node |