diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/form_helper_test.rb | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 80a00b2a10..46b2902fb1 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -528,7 +528,7 @@ module ActionView builder = options[:builder] || ActionView::Base.default_form_builder - with_output_buffer do + capture do yield builder.new(object_name, object, self, options, block) end end diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 28a13b07be..47ac911540 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -1518,6 +1518,11 @@ class FormHelperTest < ActionView::TestCase assert_equal expected, output_buffer end + def test_fields_for_returns_block_result + output = fields_for(Post.new) { |f| "fields" } + assert_equal "fields", output + end + protected def comments_path(post) "/posts/#{post.id}/comments" |