aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/new_base
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-03-23 12:07:34 -0700
committerYehuda Katz <wycats@gmail.com>2009-03-23 12:07:34 -0700
commit34f058e082754bb726a4753fa26e8e8c082702c0 (patch)
treee6257c788360580559500b99c00bc2f49c8317c0 /actionpack/lib/action_controller/new_base
parent4a93148bfe0194acb7bcafd6c830d5b86372be6a (diff)
downloadrails-34f058e082754bb726a4753fa26e8e8c082702c0.tar.gz
rails-34f058e082754bb726a4753fa26e8e8c082702c0.tar.bz2
rails-34f058e082754bb726a4753fa26e8e8c082702c0.zip
Add a bunch of tests for various render :action, layout combinations
Diffstat (limited to 'actionpack/lib/action_controller/new_base')
-rw-r--r--actionpack/lib/action_controller/new_base/layouts.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/new_base/layouts.rb b/actionpack/lib/action_controller/new_base/layouts.rb
index da516c0b85..3b47a76077 100644
--- a/actionpack/lib/action_controller/new_base/layouts.rb
+++ b/actionpack/lib/action_controller/new_base/layouts.rb
@@ -2,7 +2,7 @@ module ActionController
module Layouts
def render_to_string(options)
if !options.key?(:text) || options.key?(:layout)
- options[:_layout] = options.key?(:layout) ? _layout_for_option(options[:layout]) : _layout
+ options[:_layout] = options.key?(:layout) ? _layout_for_option(options[:layout]) : _default_layout
end
super
@@ -13,7 +13,7 @@ module ActionController
def _layout_for_option(name)
case name
when String then _layout_for_name(name)
- when true then _layout
+ when true then _default_layout(true)
when false then nil
end
end
@@ -22,13 +22,14 @@ module ActionController
view_paths.find_by_parts(name, formats, "layouts")
end
- def _layout
+ def _default_layout(require_layout = false)
begin
_layout_for_name(controller_path)
rescue ActionView::MissingTemplate
begin
_layout_for_name("application")
- rescue ActionView::MissingTemplate
+ rescue ActionView::MissingTemplate => e
+ raise e if require_layout
end
end
end