From cbded53671bccccbaf7e9fdfa93ef86cb097daa3 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Thu, 5 Nov 2009 20:07:14 -0800 Subject: When rendering layouts with blocks, use #capture to avoid assuming that the return value is the block's content. Signed-off-by: Yehuda Katz --- actionpack/lib/action_view/render/rendering.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/render/rendering.rb b/actionpack/lib/action_view/render/rendering.rb index fc89726670..7006a5b968 100644 --- a/actionpack/lib/action_view/render/rendering.rb +++ b/actionpack/lib/action_view/render/rendering.rb @@ -71,12 +71,10 @@ module ActionView # In this case, the layout would receive the block passed into render :layout, # and the Struct specified in the layout would be passed into the block. The result # would be Hello David. - def _layout_for(name = nil) + def _layout_for(name = nil, &block) return @_content_for[name || :layout] if !block_given? || name - with_output_buffer do - return yield - end + capture(&block) end def _render_inline(inline, layout, options) -- cgit v1.2.3