fields_for returns block result when outside ERB

Signed-off-by: wycats <wycats@gmail.com>
This commit is contained in:
Ryan Bates
2010-04-10 11:05:42 -07:00
committed by wycats
parent 59c6082d98
commit e5f392ce8f
2 changed files with 6 additions and 1 deletions

View File

@@ -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

View File

@@ -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"