mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
fields_for returns block result when outside ERB
Signed-off-by: wycats <wycats@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user