mirror of
https://github.com/github/rails.git
synced 2026-04-04 03:00:58 -04:00
render(:action) and render() are the only two render calls to use a layout by default. All others default to :layout => false. Also, allow :layout => true to be a synonym for :layout => nil.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1378 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
*SVN*
|
||||
|
||||
* render(:inline) always defaults to :layout => false.
|
||||
* render(:layout => true) is a synonym for render(:layout => nil)
|
||||
|
||||
* 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.
|
||||
* render(:action) and render() are the only two calls that default to using a layout. All other render calls assume :layout => false. This also fixes send_file, which was applying a layout if one existed for the current action.
|
||||
|
||||
* verify with :redirect_to won't redirect if a redirect or render has already been performed #1350
|
||||
|
||||
|
||||
@@ -490,7 +490,7 @@ module ActionController #:nodoc:
|
||||
render(options.merge({ :text => "" }))
|
||||
|
||||
else
|
||||
render(options.merge({ :template => default_template_name }))
|
||||
render(options.merge({ :action => action_name }))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -220,12 +220,10 @@ module ActionController #:nodoc:
|
||||
private
|
||||
def render_with_a_layout_options(options)
|
||||
return options unless options.is_a?(Hash)
|
||||
case
|
||||
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
|
||||
if options.values_at(:text, :file, :template, :inline, :partial, :nothing).compact.empty?
|
||||
options
|
||||
else
|
||||
{ :layout => false }.merge(options)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -236,7 +234,7 @@ module ActionController #:nodoc:
|
||||
case options[:layout]
|
||||
when FalseClass
|
||||
nil
|
||||
when NilClass
|
||||
when NilClass, TrueClass
|
||||
active_layout if action_has_layout?
|
||||
else
|
||||
active_layout(options[:layout])
|
||||
|
||||
@@ -78,7 +78,7 @@ class NewRenderTestController < ActionController::Base
|
||||
end
|
||||
|
||||
def partial_only_with_layout
|
||||
render :partial => "partial_only", :layout => nil
|
||||
render :partial => "partial_only", :layout => true
|
||||
end
|
||||
|
||||
def hello_in_a_string
|
||||
@@ -99,7 +99,7 @@ class NewRenderTestController < ActionController::Base
|
||||
private
|
||||
def determine_layout
|
||||
case action_name
|
||||
when "layout_test", "rendering_without_layout",
|
||||
when "hello_world", "layout_test", "rendering_without_layout",
|
||||
"rendering_nothing_on_layout", "render_text_hello_world",
|
||||
"partial_only", "partial_only_with_layout",
|
||||
"accessing_params_in_template",
|
||||
@@ -132,6 +132,7 @@ class NewRenderTest < Test::Unit::TestCase
|
||||
get :hello_world
|
||||
assert_response :success
|
||||
assert_template "test/hello_world"
|
||||
assert_equal "<html>Hello world!</html>", @response.body
|
||||
end
|
||||
|
||||
def test_do_with_render
|
||||
|
||||
Reference in New Issue
Block a user