Skip to content
Browse files

hash on the template directory in order to improve cache hits

  • Loading branch information...
1 parent 9404040 commit 295a7fd1bb8f56a1c35162bb944c36357008001a @tenderlove tenderlove committed Aug 8, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 actionpack/lib/action_view/template/resolver.rb
View
5 actionpack/lib/action_view/template/resolver.rb
@@ -132,10 +132,11 @@ def find_templates(name, prefix, partial, details)
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

0 comments on commit 295a7fd

Please sign in to comment.
Something went wrong with that request. Please try again.