提交 fae2e4d0 编写于 作者: R Rafael Mendonça França

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

Fix for #9360 content_for regression
......@@ -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'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册