diff options
author | Yehuda Katz and Carl Lerche <wycats@gmail.com> | 2009-04-07 17:57:20 -0700 |
---|---|---|
committer | Yehuda Katz and Carl Lerche <wycats@gmail.com> | 2009-04-07 17:57:20 -0700 |
commit | 3cecbc21e37f772a72917f80c53a7645f81d94c5 (patch) | |
tree | fbdb4e9a6934e066ecc14e06b7f76202d54e29b1 /actionpack/lib/action_controller/new_base | |
parent | 95c9718118bc0342ddb320f23b5e0a17fb12b7ad (diff) | |
download | rails-3cecbc21e37f772a72917f80c53a7645f81d94c5.tar.gz rails-3cecbc21e37f772a72917f80c53a7645f81d94c5.tar.bz2 rails-3cecbc21e37f772a72917f80c53a7645f81d94c5.zip |
Get Base2 layouts to work :)
Diffstat (limited to 'actionpack/lib/action_controller/new_base')
-rw-r--r-- | actionpack/lib/action_controller/new_base/layouts.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/new_base/layouts.rb b/actionpack/lib/action_controller/new_base/layouts.rb index 2351472dad..149847c968 100644 --- a/actionpack/lib/action_controller/new_base/layouts.rb +++ b/actionpack/lib/action_controller/new_base/layouts.rb @@ -3,12 +3,35 @@ module ActionController depends_on ActionController::Renderer depends_on AbstractController::Layouts + module ClassMethods + def _implied_layout_name + controller_path + end + end + def render_to_string(options) + # render :text => ..., :layout => ... + # or + # render :anything_else if !options.key?(:text) || options.key?(:layout) options[:_layout] = options.key?(:layout) ? _layout_for_option(options[:layout]) : _default_layout end super end + + private + + def _layout_for_option(name) + case name + when String then _layout_for_name(name) + when true then _default_layout(true) + when false, nil then nil + else + raise ArgumentError, + "String, true, or false, expected for `layout'; you passed #{name.inspect}" + end + end + end end
\ No newline at end of file |