From c255e0eed5849ed7866d3c5999a4e04a0e625b9c Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Mon, 5 Sep 2011 06:10:12 -0700 Subject: Merge pull request #2799 from tomstuart/3-1-stable Never return stored content from content_for when a block is given --- actionpack/lib/action_view/helpers/capture_helper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/capture_helper.rb b/actionpack/lib/action_view/helpers/capture_helper.rb index 62f95379cd..8abd85c3a3 100644 --- a/actionpack/lib/action_view/helpers/capture_helper.rb +++ b/actionpack/lib/action_view/helpers/capture_helper.rb @@ -134,9 +134,9 @@ module ActionView # WARNING: content_for is ignored in caches. So you shouldn't use it # for elements that will be fragment cached. def content_for(name, content = nil, &block) - content = capture(&block) if block_given? - if content - @view_flow.append(name, content) + if content || block_given? + content = capture(&block) if block_given? + @view_flow.append(name, content) if content nil else @view_flow.get(name) -- cgit v1.2.3