From 295a7fd1bb8f56a1c35162bb944c36357008001a Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 8 Aug 2011 21:03:40 -0700 Subject: hash on the template directory in order to improve cache hits --- actionpack/lib/action_view/template/resolver.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_view/template/resolver.rb b/actionpack/lib/action_view/template/resolver.rb index 7c1636fb60..979be701b2 100644 --- a/actionpack/lib/action_view/template/resolver.rb +++ b/actionpack/lib/action_view/template/resolver.rb @@ -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 -- cgit v1.2.3