diff options
author | José Valim <jose.valim@gmail.com> | 2010-03-08 16:32:40 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-03-08 16:32:40 +0100 |
commit | 68cda695da27f57cae682d160a13dab4dacb1ef8 (patch) | |
tree | 3a3aedb66bc64e4e70220b3f051cd71356373226 /actionpack/lib/action_view/render | |
parent | 44ebab96da0ab47cc45c64a6efdd2cbb80f9d042 (diff) | |
download | rails-68cda695da27f57cae682d160a13dab4dacb1ef8.tar.gz rails-68cda695da27f57cae682d160a13dab4dacb1ef8.tar.bz2 rails-68cda695da27f57cae682d160a13dab4dacb1ef8.zip |
Speed up performance in resolvers by adding fallbacks just when required.
Diffstat (limited to 'actionpack/lib/action_view/render')
-rw-r--r-- | actionpack/lib/action_view/render/layouts.rb | 3 | ||||
-rw-r--r-- | actionpack/lib/action_view/render/rendering.rb | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/render/layouts.rb b/actionpack/lib/action_view/render/layouts.rb index b9c63e0090..91a92a833a 100644 --- a/actionpack/lib/action_view/render/layouts.rb +++ b/actionpack/lib/action_view/render/layouts.rb @@ -48,7 +48,8 @@ module ActionView # the given name exists across all details before raising the error. def _find_layout(layout) #:nodoc: begin - find_template(layout) + layout =~ /^\// ? + with_fallbacks { find_template(layout) } : find_template(layout) rescue ActionView::MissingTemplate => e update_details(:formats => nil) do raise unless template_exists?(layout) diff --git a/actionpack/lib/action_view/render/rendering.rb b/actionpack/lib/action_view/render/rendering.rb index 96c0b4fe6a..d11f1fa2a7 100644 --- a/actionpack/lib/action_view/render/rendering.rb +++ b/actionpack/lib/action_view/render/rendering.rb @@ -63,7 +63,7 @@ module ActionView elsif options.key?(:text) Template::Text.new(options[:text], self.formats.try(:first)) elsif options.key?(:file) - find_template(options[:file], options[:_prefix]) + with_fallbacks { find_template(options[:file], options[:_prefix]) } elsif options.key?(:template) find_template(options[:template], options[:_prefix]) end |