diff options
author | Marcel Molina <marcel@vernix.org> | 2005-12-20 05:32:39 +0000 |
---|---|---|
committer | Marcel Molina <marcel@vernix.org> | 2005-12-20 05:32:39 +0000 |
commit | 233208b8bb638bab3ee7f8f88e227fa7d8ee9c7e (patch) | |
tree | 2d11929130e34a17bc68fba22ccf52b5f55c8b59 | |
parent | 3c01e01ded4e8e87d48e844881c88f6e47cebdf0 (diff) | |
download | rails-233208b8bb638bab3ee7f8f88e227fa7d8ee9c7e.tar.gz rails-233208b8bb638bab3ee7f8f88e227fa7d8ee9c7e.tar.bz2 rails-233208b8bb638bab3ee7f8f88e227fa7d8ee9c7e.zip |
Don't try to strip out the controller name if default_action_name is nil
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3321 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rwxr-xr-x | actionpack/lib/action_controller/base.rb | 6 | ||||
-rw-r--r-- | actionpack/test/controller/new_render_test.rb | 10 | ||||
-rw-r--r-- | actionpack/test/fixtures/test/hello_world_with_layout_false.rhtml | 1 |
3 files changed, 15 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index c1adbf3b8a..316490736b 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -937,8 +937,10 @@ module ActionController #:nodoc: end def default_template_name(default_action_name = action_name) - default_action_name = default_action_name.dup - strip_out_controller!(default_action_name) if template_path_includes_controller?(default_action_name) + if default_action_name + default_action_name = default_action_name.dup + strip_out_controller!(default_action_name) if template_path_includes_controller?(default_action_name) + end "#{self.class.controller_path}/#{default_action_name}" end diff --git a/actionpack/test/controller/new_render_test.rb b/actionpack/test/controller/new_render_test.rb index 5652803e1d..38d4cdb648 100644 --- a/actionpack/test/controller/new_render_test.rb +++ b/actionpack/test/controller/new_render_test.rb @@ -40,6 +40,10 @@ class NewRenderTestController < ActionController::Base render :text => "hello world", :layout => true end + def hello_world_with_layout_false + render :layout => false + end + def render_custom_code render :text => "hello world", :status => "404 Moved" end @@ -205,6 +209,7 @@ class NewRenderTestController < ActionController::Base when "hello_world", "layout_test", "rendering_without_layout", "rendering_nothing_on_layout", "render_text_hello_world", "render_text_hello_world_with_layout", + "hello_world_with_layout_false", "partial_only", "partial_only_with_layout", "accessing_params_in_template", "accessing_params_in_template_with_layout", @@ -271,6 +276,11 @@ class NewRenderTest < Test::Unit::TestCase assert_equal "<html>hello world, I'm here!</html>", @response.body end + def test_do_with_render_action_and_layout_false + get :hello_world_with_layout_false + assert_equal 'Hello world!', @response.body + end + def test_do_with_render_custom_code get :render_custom_code assert_response :missing diff --git a/actionpack/test/fixtures/test/hello_world_with_layout_false.rhtml b/actionpack/test/fixtures/test/hello_world_with_layout_false.rhtml new file mode 100644 index 0000000000..6769dd60bd --- /dev/null +++ b/actionpack/test/fixtures/test/hello_world_with_layout_false.rhtml @@ -0,0 +1 @@ +Hello world!
\ No newline at end of file |