1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

hash on the template directory in order to improve cache hits

This commit is contained in:
Aaron Patterson 2011-08-08 21:03:40 -07:00
parent 940404096f
commit 295a7fd1bb

View file

@ -132,10 +132,11 @@ module ActionView
def query(path, details, formats)
query = build_query(path, details)
templates = []
sanitizer = Hash.new { |h,k| h[k] = Dir["#{File.dirname(k)}/*"] }
sanitizer = Hash.new { |h,dir| h[dir] = Dir["#{dir}/*"] }
Dir[query].each do |template|
next if File.directory?(template) || !sanitizer[template].include?(template)
next if File.directory?(template)
next unless sanitizer[File.dirname(template)].include?(template)
handler, format = extract_handler_and_format(template, formats)
contents = File.binread template