From 2451177f37aa252513ac372d24cba6a3c44c054b Mon Sep 17 00:00:00 2001 From: Javan Makhmali Date: Tue, 14 Jun 2016 17:23:44 -0400 Subject: Fix digesting templates with identical logical names when requesting a format other than the first default --- actionview/lib/action_view/digestor.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'actionview/lib/action_view/digestor.rb') diff --git a/actionview/lib/action_view/digestor.rb b/actionview/lib/action_view/digestor.rb index b91e61da18..bc42b5dae1 100644 --- a/actionview/lib/action_view/digestor.rb +++ b/actionview/lib/action_view/digestor.rb @@ -15,7 +15,7 @@ module ActionView # * partial - 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) @@ -39,8 +39,11 @@ 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) } + format = finder.rendered_format + formats = finder.formats.without(format).unshift(format) + + if finder.disable_cache { finder.exists?(logical_name, [], partial, [], formats: formats) } + template = finder.disable_cache { finder.find(logical_name, [], partial, [], formats: formats) } if node = seen[template.identifier] # handle cycles in the tree node -- cgit v1.2.3