Permalink
Browse files

Fix #9360 regression in content_for

  • Loading branch information...
killthekitten committed Feb 21, 2013
1 parent b4051ed commit 371a5f2d73f73243ec2440305fdfab64088f35a3
View
@@ -999,4 +999,6 @@
* `ActionView::Helpers::TextHelper#highlight` now defaults to the
HTML5 `mark` element. *Brian Cardarella*
+* Fixed `ActionView::Helpers::CaptureHelper#content_for` regression (described in #9360). *Nikolay Shebanov*
+
Please check [3-2-stable](https://github.com/rails/rails/blob/3-2-stable/actionpack/CHANGELOG.md) for previous changes.
@@ -156,7 +156,7 @@ def content_for(name, content = nil, options = {}, &block)
end
nil
else
- @view_flow.get(name)
+ @view_flow.get(name).presence
end
end
@@ -137,6 +137,10 @@ def test_content_for_returns_nil_when_writing
assert_equal 'bar', content_for(:title)
end
+ def test_content_for_returns_nil_when_content_missing
+ assert_equal nil, content_for(:some_missing_key)
+ end
+
def test_content_for_question_mark
assert ! content_for?(:title)
content_for :title, 'title'

0 comments on commit 371a5f2

Please sign in to comment.