Merge pull request #9366 from killthekitten/fix-content_for-regression
Fix for #9360 content_for regression
This commit is contained in:
commit
fae2e4d05d
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user