aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/render/layouts.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-06-07 10:13:41 +0200
committerJosé Valim <jose.valim@gmail.com>2010-06-07 10:13:41 +0200
commit5273bd97e6746bd5bdc2450ad5a2d60f6a6eb7ae (patch)
tree23d99be0735ada0ea0be1b84fdca31cf449263d3 /actionpack/lib/action_view/render/layouts.rb
parentb3d2080278fc2b17d64010c3bfb149a08583b667 (diff)
downloadrails-5273bd97e6746bd5bdc2450ad5a2d60f6a6eb7ae.tar.gz
rails-5273bd97e6746bd5bdc2450ad5a2d60f6a6eb7ae.tar.bz2
rails-5273bd97e6746bd5bdc2450ad5a2d60f6a6eb7ae.zip
Make AP test suite green once again and speed up performance in layouts lookup for some cases.
Diffstat (limited to 'actionpack/lib/action_view/render/layouts.rb')
-rw-r--r--actionpack/lib/action_view/render/layouts.rb15
1 files changed, 3 insertions, 12 deletions
diff --git a/actionpack/lib/action_view/render/layouts.rb b/actionpack/lib/action_view/render/layouts.rb
index 255c44450d..a9dfc0cced 100644
--- a/actionpack/lib/action_view/render/layouts.rb
+++ b/actionpack/lib/action_view/render/layouts.rb
@@ -57,15 +57,11 @@ module ActionView
# This is the method which actually finds the layout using details in the lookup
# context object. If no layout is found, it checkes if at least a layout with
# the given name exists across all details before raising the error.
- #
- # If self.formats contains several formats, just the first one is considered in
- # the layout lookup.
def find_layout(layout)
begin
- if formats.size == 1
- _find_layout(layout)
- else
- update_details(:formats => [self.formats.first]) { _find_layout(layout) }
+ with_layout_format do
+ layout =~ /^\// ?
+ with_fallbacks { find_template(layout) } : find_template(layout)
end
rescue ActionView::MissingTemplate => e
update_details(:formats => nil) do
@@ -74,11 +70,6 @@ module ActionView
end
end
- def _find_layout(layout) #:nodoc:
- layout =~ /^\// ?
- with_fallbacks { find_template(layout) } : find_template(layout)
- end
-
# Contains the logic that actually renders the layout.
def _render_layout(layout, locals, &block) #:nodoc:
layout.render(self, locals){ |*name| _layout_for(*name, &block) }