Permalink
Browse files

render(:inline) in a layout before yield replaces original content

[#4777 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
Neeraj Singh authored and josevalim committed Jun 13, 2010
1 parent b514b4d commit e574ca920d315158a4af5c906b23ea0082c5690f
@@ -56,7 +56,7 @@ def _render_template(template, layout = nil, options = {}) #:nodoc:
: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
@@ -0,0 +1,2 @@
+<%= render :inline => 'welcome' %>
+<%= yield %>
@@ -229,6 +229,12 @@ def test_render_with_layout
@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

0 comments on commit e574ca9

Please sign in to comment.