1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Allow pass multipart option to form_for

This commit is contained in:
Grzegorz Derebecki 2013-03-16 15:26:42 +01:00
parent 9a421aaa82
commit 3ab7ddb8da
2 changed files with 3 additions and 3 deletions

View file

@ -433,7 +433,7 @@ module ActionView
builder = instantiate_builder(object_name, object, options)
output = capture(builder, &block)
html_options[:multipart] = builder.multipart?
html_options[:multipart] ||= builder.multipart?
form_tag(options[:url] || {}, html_options) { output }
end

View file

@ -2791,8 +2791,8 @@ class FormHelperTest < ActionView::TestCase
end
def test_form_for_with_html_options_adds_options_to_form_tag
form_for(@post, html: { id: 'some_form', class: 'some_class' }) do |f| end
expected = whole_form("/posts/123", "some_form", "some_class", method: "patch")
form_for(@post, html: { id: 'some_form', class: 'some_class', multipart: true }) do |f| end
expected = whole_form("/posts/123", "some_form", "some_class", method: "patch", multipart: "multipart/form-data")
assert_dom_equal expected, output_buffer
end