aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template/resolver.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-08-08 21:03:40 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-08-08 21:03:40 -0700
commit295a7fd1bb8f56a1c35162bb944c36357008001a (patch)
tree195edef8dca75d95da4952f736cc13aa03012202 /actionpack/lib/action_view/template/resolver.rb
parent940404096fecd57fdece94d0a6cfe524f20a2aa8 (diff)
downloadrails-295a7fd1bb8f56a1c35162bb944c36357008001a.tar.gz
rails-295a7fd1bb8f56a1c35162bb944c36357008001a.tar.bz2
rails-295a7fd1bb8f56a1c35162bb944c36357008001a.zip
hash on the template directory in order to improve cache hits
Diffstat (limited to 'actionpack/lib/action_view/template/resolver.rb')
-rw-r--r--actionpack/lib/action_view/template/resolver.rb5
1 files changed, 3 insertions, 2 deletions
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