aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib
diff options
context:
space:
mode:
Diffstat (limited to 'actionview/lib')
-rw-r--r--actionview/lib/action_view/digestor.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/actionview/lib/action_view/digestor.rb b/actionview/lib/action_view/digestor.rb
index dbd7a4ee11..45cf48b3e0 100644
--- a/actionview/lib/action_view/digestor.rb
+++ b/actionview/lib/action_view/digestor.rb
@@ -45,9 +45,8 @@ module ActionView
# Create a dependency tree for template named +name+.
def tree(name, finder, partial = false, seen = {})
logical_name = name.gsub(%r|/_|, "/")
- finder.formats = [finder.rendered_format] if finder.rendered_format
- if template = finder.disable_cache { finder.find_all(logical_name, [], partial, []).first }
+ if template = find_template(finder, logical_name, [], partial, [])
finder.rendered_format ||= template.formats.first
if node = seen[template.identifier] # handle cycles in the tree
@@ -69,6 +68,17 @@ module ActionView
seen[name] ||= Missing.new(name, logical_name, nil)
end
end
+
+ private
+ def find_template(finder, *args)
+ finder.disable_cache do
+ if format = finder.rendered_format
+ finder.find_all(*args, formats: [format]).first || finder.find_all(*args).first
+ else
+ finder.find_all(*args).first
+ end
+ end
+ end
end
class Node