Skip to content

Commit

Permalink
render(:inline) defaults to :layout => false
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1372 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jamis committed May 30, 2005
1 parent f8542a6 commit 6ce5831
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions actionpack/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*SVN*

* render(:inline) always defaults to :layout => false.

* Make sure the benchmarking render method always returns the output of the render.

* render(:text), render(:partial), and render(:nothing) always default to :layout => false. This also fixes send_file, which was applying a layout if one existed for the current action.
Expand Down
4 changes: 2 additions & 2 deletions actionpack/lib/action_controller/layout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ def render_with_a_layout(options = {}, deprecated_status = nil, deprecated_layou
def render_with_a_layout_options(options)
return options unless options.is_a?(Hash)
case
when options[:text], options[:partial], options[:nothing]
# by default, :text, :partial, and :nothing never use a layout
when options[:text], options[:partial], options[:nothing], options[:inline]
# by default, :text, :partial, :inline, and :nothing never use a layout
{ :layout => false }.merge(options)
else
options
Expand Down
13 changes: 12 additions & 1 deletion actionpack/test/controller/new_render_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,20 @@ def accessing_params_in_template
render :inline => "Hello: <%= params[:name] %>"
end

def accessing_params_in_template_with_layout
render :inline => "Hello: <%= params[:name] %>", :layout => nil
end

def rescue_action(e) raise end

private
def determine_layout
case action_name
when "layout_test", "rendering_without_layout",
"rendering_nothing_on_layout", "render_text_hello_world",
"partial_only", "partial_only_with_layout"
"partial_only", "partial_only_with_layout",
"accessing_params_in_template",
"accessing_params_in_template_with_layout"
"layouts/standard"
when "builder_layout_test"
"layouts/builder"
Expand Down Expand Up @@ -237,4 +243,9 @@ def test_accessing_params_in_template
get :accessing_params_in_template, :name => "David"
assert_equal "Hello: David", @response.body
end

def test_accessing_params_in_template_with_layout
get :accessing_params_in_template_with_layout, :name => "David"
assert_equal "<html>Hello: David</html>", @response.body
end
end

0 comments on commit 6ce5831

Please sign in to comment.