diff --git a/actionview/lib/action_view/flows.rb b/actionview/lib/action_view/flows.rb index 1609777182..59e6804e1a 100644 --- a/actionview/lib/action_view/flows.rb +++ b/actionview/lib/action_view/flows.rb @@ -17,12 +17,12 @@ module ActionView # Called by each renderer object to set the layout contents. def set(key, value) - @content[key] = ActiveSupport::SafeBuffer.new(value) + @content[key] = ActiveSupport::SafeBuffer.new(value.to_s) end # Called by content_for def append(key, value) - @content[key] << value + @content[key] << value.to_s end alias_method :append!, :append end diff --git a/actionview/test/template/capture_helper_test.rb b/actionview/test/template/capture_helper_test.rb index 45070674ad..69b1cf06e4 100644 --- a/actionview/test/template/capture_helper_test.rb +++ b/actionview/test/template/capture_helper_test.rb @@ -51,14 +51,14 @@ class CaptureHelperTest < ActionView::TestCase def test_content_for_with_multiple_calls assert_not content_for?(:title) content_for :title, "foo" - content_for :title, "bar" + content_for :title, :bar assert_equal "foobar", content_for(:title) end def test_content_for_with_multiple_calls_and_flush assert_not content_for?(:title) content_for :title, "foo" - content_for :title, "bar", flush: true + content_for :title, :bar, flush: true assert_equal "bar", content_for(:title) end @@ -172,7 +172,7 @@ class CaptureHelperTest < ActionView::TestCase assert_equal "hi<p>title</p>", content_for(:title) @view_flow = ActionView::OutputFlow.new - provide :title, "hi" + provide :title, :hi provide :title, raw("

title

") assert_equal "hi

title

", content_for(:title) end