mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
render(:inline) in a layout before yield replaces original content
[#4777 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
parent
b514b4d696
commit
e574ca920d
3 changed files with 9 additions and 1 deletions
|
@ -56,7 +56,7 @@ module ActionView
|
|||
:identifier => template.identifier, :layout => layout.try(:virtual_path)) do
|
||||
|
||||
content = template.render(self, locals) { |*name| _layout_for(*name) }
|
||||
@_content_for[:layout] = content
|
||||
@_content_for[:layout] = content if layout
|
||||
|
||||
content = _render_layout(layout, locals) if layout
|
||||
content
|
||||
|
|
2
actionpack/test/fixtures/layouts/yield_with_render_inline_inside.erb
vendored
Normal file
2
actionpack/test/fixtures/layouts/yield_with_render_inline_inside.erb
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
<%= render :inline => 'welcome' %>
|
||||
<%= yield %>
|
|
@ -229,6 +229,12 @@ module RenderTestCases
|
|||
@view.render(:file => "test/hello_world.erb", :layout => "layouts/yield")
|
||||
end
|
||||
|
||||
def test_render_with_layout_which_has_render_inline
|
||||
assert_equal %(welcome\nHello world!\n),
|
||||
@view.render(:file => "test/hello_world.erb", :layout => "layouts/yield_with_render_inline_inside")
|
||||
end
|
||||
|
||||
|
||||
# TODO: Move to deprecated_tests.rb
|
||||
def test_render_with_nested_layout_deprecated
|
||||
assert_deprecated do
|
||||
|
|
Loading…
Reference in a new issue