aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2011-09-05 06:10:12 -0700
committerSantiago Pastorino <santiago@wyeworks.com>2011-09-05 10:11:43 -0300
commitc255e0eed5849ed7866d3c5999a4e04a0e625b9c (patch)
tree04b62427864147473bdfbbea15be9c7fceb4043a /actionpack/lib
parente221108c141fa564b7da6378478b762b356e0084 (diff)
downloadrails-c255e0eed5849ed7866d3c5999a4e04a0e625b9c.tar.gz
rails-c255e0eed5849ed7866d3c5999a4e04a0e625b9c.tar.bz2
rails-c255e0eed5849ed7866d3c5999a4e04a0e625b9c.zip
Merge pull request #2799 from tomstuart/3-1-stable
Never return stored content from content_for when a block is given
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/helpers/capture_helper.rb6
1 files changed, 3 insertions, 3 deletions
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)