aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller/layouts.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-10-17 10:31:11 -0300
committerYehuda Katz <wycats@gmail.com>2009-11-01 02:23:47 +0100
commita9751a7034c5a2a49fd90e9f79ad5fcae103487b (patch)
tree59845a0bb38830586cbe475ec82ec50d6c545618 /actionpack/lib/abstract_controller/layouts.rb
parentf4f76772fb5c25357a54baaa9cd20f7e9a1cd653 (diff)
downloadrails-a9751a7034c5a2a49fd90e9f79ad5fcae103487b.tar.gz
rails-a9751a7034c5a2a49fd90e9f79ad5fcae103487b.tar.bz2
rails-a9751a7034c5a2a49fd90e9f79ad5fcae103487b.zip
Refactor ActionMailer layout and remove legacy one.
Diffstat (limited to 'actionpack/lib/abstract_controller/layouts.rb')
-rw-r--r--actionpack/lib/abstract_controller/layouts.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb
index 796ef40584..4723e18a01 100644
--- a/actionpack/lib/abstract_controller/layouts.rb
+++ b/actionpack/lib/abstract_controller/layouts.rb
@@ -171,6 +171,26 @@ module AbstractController
name && _find_layout(name, details)
end
+ # Determine the layout for a given name and details, taking into account
+ # the name type.
+ #
+ # ==== Parameters
+ # name<String|TrueClass|FalseClass|Symbol>:: The name of the template
+ # details<Hash{Symbol => Object}>:: A list of details to restrict
+ # the lookup to. By default, layout lookup is limited to the
+ # formats specified for the current request.
+ def _layout_for_option(name, details)
+ case name
+ when String then _layout_for_name(name, details)
+ when true then _default_layout(details, true)
+ when :default then _default_layout(details, false)
+ when false, nil then nil
+ else
+ raise ArgumentError,
+ "String, true, or false, expected for `layout'; you passed #{name.inspect}"
+ end
+ end
+
# Take in the name and details and find a Template.
#
# ==== Parameters