diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG.md | 6 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/capture_helper.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/capture_helper_test.rb | 4 |
3 files changed, 11 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index 180d802dbe..3fc3e06160 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -1,5 +1,11 @@ ## Rails 4.0.0 (unreleased) ## +* Fixed `ActionView::Helpers::CaptureHelper#content_for` regression when trying to use it in + a boolean statement. + Fixes #9360. + + *Nikolay Shebanov* + * `format: true` does not override existing format constraints. Fixes #9466. diff --git a/actionpack/lib/action_view/helpers/capture_helper.rb b/actionpack/lib/action_view/helpers/capture_helper.rb index 4ec860d69a..1bad82159a 100644 --- a/actionpack/lib/action_view/helpers/capture_helper.rb +++ b/actionpack/lib/action_view/helpers/capture_helper.rb @@ -156,7 +156,7 @@ module ActionView end nil else - @view_flow.get(name) + @view_flow.get(name).presence end end diff --git a/actionpack/test/template/capture_helper_test.rb b/actionpack/test/template/capture_helper_test.rb index 234ac3252d..938f1c3e54 100644 --- a/actionpack/test/template/capture_helper_test.rb +++ b/actionpack/test/template/capture_helper_test.rb @@ -137,6 +137,10 @@ class CaptureHelperTest < ActionView::TestCase 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' |