Skip to content

Commit

Permalink
Don't try to strip out the controller name if default_action_name is nil
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3321 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
Marcel Molina committed Dec 20, 2005
1 parent 3c01e01 commit 233208b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 4 additions & 2 deletions actionpack/lib/action_controller/base.rb
Expand Up @@ -937,8 +937,10 @@ def assert_existance_of_template_file(template_name)
end end


def default_template_name(default_action_name = action_name) def default_template_name(default_action_name = action_name)
default_action_name = default_action_name.dup if default_action_name
strip_out_controller!(default_action_name) if template_path_includes_controller?(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}" "#{self.class.controller_path}/#{default_action_name}"
end end


Expand Down
10 changes: 10 additions & 0 deletions actionpack/test/controller/new_render_test.rb
Expand Up @@ -40,6 +40,10 @@ def render_text_hello_world_with_layout
render :text => "hello world", :layout => true render :text => "hello world", :layout => true
end end


def hello_world_with_layout_false
render :layout => false
end

def render_custom_code def render_custom_code
render :text => "hello world", :status => "404 Moved" render :text => "hello world", :status => "404 Moved"
end end
Expand Down Expand Up @@ -205,6 +209,7 @@ def determine_layout
when "hello_world", "layout_test", "rendering_without_layout", when "hello_world", "layout_test", "rendering_without_layout",
"rendering_nothing_on_layout", "render_text_hello_world", "rendering_nothing_on_layout", "render_text_hello_world",
"render_text_hello_world_with_layout", "render_text_hello_world_with_layout",
"hello_world_with_layout_false",
"partial_only", "partial_only_with_layout", "partial_only", "partial_only_with_layout",
"accessing_params_in_template", "accessing_params_in_template",
"accessing_params_in_template_with_layout", "accessing_params_in_template_with_layout",
Expand Down Expand Up @@ -271,6 +276,11 @@ def test_do_with_render_text_and_layout
assert_equal "<html>hello world, I'm here!</html>", @response.body assert_equal "<html>hello world, I'm here!</html>", @response.body
end 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 def test_do_with_render_custom_code
get :render_custom_code get :render_custom_code
assert_response :missing assert_response :missing
Expand Down
@@ -0,0 +1 @@
Hello world!

0 comments on commit 233208b

Please sign in to comment.