aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2019-04-12 15:40:33 -0700
committerJohn Hawthorn <john@hawthorn.email>2019-04-12 15:40:33 -0700
commit0b26cc41dbd8c57eb382318a63c4272de3d2e4e9 (patch)
tree531f4110924b982a02d59f0fd8c8e6ea795e24e9 /actionview
parent53e4055a75fc16bf31aeb295ec18c07a3059db57 (diff)
downloadrails-0b26cc41dbd8c57eb382318a63c4272de3d2e4e9.tar.gz
rails-0b26cc41dbd8c57eb382318a63c4272de3d2e4e9.tar.bz2
rails-0b26cc41dbd8c57eb382318a63c4272de3d2e4e9.zip
Avoid duplication using _find_all
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/template/resolver.rb18
1 files changed, 7 insertions, 11 deletions
diff --git a/actionview/lib/action_view/template/resolver.rb b/actionview/lib/action_view/template/resolver.rb
index 6a9beede8c..ce53eb046d 100644
--- a/actionview/lib/action_view/template/resolver.rb
+++ b/actionview/lib/action_view/template/resolver.rb
@@ -118,7 +118,7 @@ module ActionView
locals = locals.map(&:to_s).sort!.freeze
cached(key, [name, prefix, partial], details, locals) do
- find_templates(name, prefix, partial, details, locals)
+ _find_all(name, prefix, partial, details, key, locals)
end
end
@@ -131,6 +131,10 @@ module ActionView
private
+ def _find_all(name, prefix, partial, details, key, locals)
+ find_templates(name, prefix, partial, details, locals)
+ end
+
delegate :caching?, to: :class
# This is what child classes implement. No defaults are needed
@@ -178,19 +182,11 @@ module ActionView
super()
end
- def find_all(name, prefix = nil, partial = false, details = {}, key = nil, locals = [])
- locals = locals.map(&:to_s).sort!.freeze
-
- cached(key, [name, prefix, partial], details, locals) do
- find_templates(name, prefix, partial, details, locals, cache: !!key)
- end
- end
-
private
- def find_templates(name, prefix, partial, details, locals, cache: true)
+ def _find_all(name, prefix, partial, details, key, locals)
path = Path.build(name, prefix, partial)
- query(path, details, details[:formats], locals, cache: cache)
+ query(path, details, details[:formats], locals, cache: !!key)
end
def query(path, details, formats, locals, cache:)