1
0
Fork 0
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:
Neeraj Singh 2010-06-12 23:00:10 -04:00 committed by José Valim
parent b514b4d696
commit e574ca920d
3 changed files with 9 additions and 1 deletions

View file

@ -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

View file

@ -0,0 +1,2 @@
<%= render :inline => 'welcome' %>
<%= yield %>

View file

@ -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