Permalink
Browse files

Merge pull request #9366 from killthekitten/fix-content_for-regression

Fix for #9360 content_for regression
  • Loading branch information...
2 parents dc53fe9 + 371a5f2 commit fae2e4d05d122e2d711a90c0a46dfb4b42dbadc3 @rafaelfranca rafaelfranca committed Feb 28, 2013
View
@@ -1041,4 +1041,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 fae2e4d

Please sign in to comment.