aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/render
diff options
context:
space:
mode:
authorNathan Weizenbaum <nex342@gmail.com>2009-11-05 20:07:14 -0800
committerYehuda Katz <wycats@Yehuda-Katz.local>2009-11-05 20:08:04 -0800
commitcbded53671bccccbaf7e9fdfa93ef86cb097daa3 (patch)
treeed0fefcbec62b2ab3f2495d3180c07c0475b24fb /actionpack/lib/action_view/render
parentcb9a1759c0b8ad104b8e591b952bc440f9e06dc0 (diff)
downloadrails-cbded53671bccccbaf7e9fdfa93ef86cb097daa3.tar.gz
rails-cbded53671bccccbaf7e9fdfa93ef86cb097daa3.tar.bz2
rails-cbded53671bccccbaf7e9fdfa93ef86cb097daa3.zip
When rendering layouts with blocks, use #capture to avoid assuming that the return value is the block's content.
Signed-off-by: Yehuda Katz <wycats@Yehuda-Katz.local>
Diffstat (limited to 'actionpack/lib/action_view/render')
-rw-r--r--actionpack/lib/action_view/render/rendering.rb6
1 files changed, 2 insertions, 4 deletions
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 <tt>render :layout</tt>,
# and the Struct specified in the layout would be passed into the block. The result
# would be <html>Hello David</html>.
- 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)