From 233208b8bb638bab3ee7f8f88e227fa7d8ee9c7e Mon Sep 17 00:00:00 2001 From: Marcel Molina Date: Tue, 20 Dec 2005 05:32:39 +0000 Subject: 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 --- actionpack/lib/action_controller/base.rb | 6 ++++-- actionpack/test/controller/new_render_test.rb | 10 ++++++++++ .../test/fixtures/test/hello_world_with_layout_false.rhtml | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 actionpack/test/fixtures/test/hello_world_with_layout_false.rhtml (limited to 'actionpack') 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 "hello world, I'm here!", @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 -- cgit v1.2.3