Skip to content
Browse files

Solved a problem that prevented render :file => work in layouts

Signed-off-by: wycats <wycats@gmail.com>
  • Loading branch information...
1 parent 8da026c commit a04b44910e57387bd1bcfbd95c3a6754a08e77af @magec magec committed with wycats Feb 23, 2010
View
2 actionpack/lib/action_view/render/rendering.rb
@@ -102,7 +102,7 @@ def _render_template(template, layout = nil, options = {})
ActiveSupport::Notifications.instrument("action_view.render_template",
:identifier => template.identifier, :layout => layout.try(:identifier)) do
- content = template.render(self, locals)
+ content = template.render(self, locals) {|*name| _layout_for(*name) }
@_content_for[:layout] = content
if layout
View
2 actionpack/test/fixtures/test/layout_render_file.erb
@@ -0,0 +1,2 @@
+<% content_for :title do %>title<% end -%>
+<%= render :file => 'layouts/yield' -%>
View
5 actionpack/test/template/render_test.rb
@@ -233,6 +233,11 @@ def test_render_with_nested_layout
@view.render(:file => "test/nested_layout.erb", :layout => "layouts/yield")
end
+ def test_render_with_file_in_layout
+ assert_equal %(\n<title>title</title>\n\n),
+ @view.render(:file => "test/layout_render_file.erb")
+ end
+
if '1.9'.respond_to?(:force_encoding)
def test_render_utf8_template_with_magic_comment
with_external_encoding Encoding::ASCII_8BIT do

0 comments on commit a04b449

Please sign in to comment.
Something went wrong with that request. Please try again.