Skip to content

Commit 295a7fd

Browse files
committed
hash on the template directory in order to improve cache hits
1 parent 9404040 commit 295a7fd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

actionpack/lib/action_view/template/resolver.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,11 @@ def find_templates(name, prefix, partial, details)
132132
def query(path, details, formats)
133133
query = build_query(path, details)
134134
templates = []
135-
sanitizer = Hash.new { |h,k| h[k] = Dir["#{File.dirname(k)}/*"] }
135+
sanitizer = Hash.new { |h,dir| h[dir] = Dir["#{dir}/*"] }
136136

137137
Dir[query].each do |template|
138-
next if File.directory?(template) || !sanitizer[template].include?(template)
138+
next if File.directory?(template)
139+
next unless sanitizer[File.dirname(template)].include?(template)
139140

140141
handler, format = extract_handler_and_format(template, formats)
141142
contents = File.binread template

0 commit comments

Comments
 (0)