1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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

Signed-off-by: wycats <wycats@gmail.com>
This commit is contained in:
Jose Fernandez 2010-02-23 18:50:05 +01:00 committed by wycats
parent 8da026cb79
commit a04b44910e
3 changed files with 8 additions and 1 deletions

View file

@ -102,7 +102,7 @@ module ActionView
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 file

@ -0,0 +1,2 @@
<% content_for :title do %>title<% end -%>
<%= render :file => 'layouts/yield' -%>

View file

@ -233,6 +233,11 @@ module RenderTestCases
@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