aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-08 16:51:47 +0100
committerJosé Valim <jose.valim@gmail.com>2011-12-08 16:51:47 +0100
commit67cc07e0c4bd071dd3d2f4098e5a4c31ba590684 (patch)
tree621bfb5d0ef90e23e099bfc356378dee23bcb86e /actionpack
parent239262fee03096d1e52acf8fe69de736726d87e0 (diff)
downloadrails-67cc07e0c4bd071dd3d2f4098e5a4c31ba590684.tar.gz
rails-67cc07e0c4bd071dd3d2f4098e5a4c31ba590684.tar.bz2
rails-67cc07e0c4bd071dd3d2f4098e5a4c31ba590684.zip
Just use the proc if there is a chance of layout lookup.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/abstract_controller/layouts.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb
index 6b6b38c64f..8356d822da 100644
--- a/actionpack/lib/abstract_controller/layouts.rb
+++ b/actionpack/lib/abstract_controller/layouts.rb
@@ -293,7 +293,7 @@ module AbstractController
if _include_layout?(options)
layout = options.key?(:layout) ? options.delete(:layout) : :default
- options[:layout] = Proc.new { _normalize_layout(_layout_for_option(layout)) }
+ options[:layout] = _layout_for_option(layout)
end
end
@@ -323,9 +323,10 @@ module AbstractController
# * <tt>name</tt> - The name of the template
def _layout_for_option(name)
case name
- when String then name
- when true then _default_layout(true)
- when :default then _default_layout(false)
+ when String then _normalize_layout(name)
+ when Proc then name
+ when true then Proc.new { _default_layout(true) }
+ when :default then Proc.new { _default_layout(false) }
when false, nil then nil
else
raise ArgumentError,
@@ -358,7 +359,7 @@ module AbstractController
"There was no default layout for #{self.class} in #{view_paths.inspect}"
end
- value
+ _normalize_layout(value)
end
def _include_layout?(options)