From ab105e6072d291d7024e4e645defa5eff31f6f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 16 Apr 2011 11:34:07 +0200 Subject: content_for should work with provide. --- actionpack/lib/action_view/helpers/capture_helper.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'actionpack/lib/action_view/helpers/capture_helper.rb') diff --git a/actionpack/lib/action_view/helpers/capture_helper.rb b/actionpack/lib/action_view/helpers/capture_helper.rb index 148d814ac7..0139714240 100644 --- a/actionpack/lib/action_view/helpers/capture_helper.rb +++ b/actionpack/lib/action_view/helpers/capture_helper.rb @@ -142,12 +142,12 @@ module ActionView # The same as +content_for+ but when used with streaming flushes # straight back to the layout. In other words, if you want to # concatenate several times to the same buffer when rendering a given - # template, you should use +content_for+, if not, use +provide+ as it - # has better streaming support. + # template, you should use +content_for+, if not, use +provide+ to tell + # the layout to stop looking for more contents. def provide(name, content = nil, &block) content = capture(&block) if block_given? - @_view_flow.set(name, content) if content - content + result = @_view_flow.append!(name, content) if content + result unless content end # content_for? simply checks whether any content has been captured yet using content_for -- cgit v1.2.3