Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #9745 from madmax/allow_pass_multipart_to_form_for

Fix regression: allow pass multipart option to form_for
  • Loading branch information...
commit e4807f0812d4b49a1a2b5c8e3c0bb5a2062c1151 2 parents be1a7eb + 3ab7ddb
@carlosantoniodasilva carlosantoniodasilva authored
View
2  actionpack/lib/action_view/helpers/form_helper.rb
@@ -433,7 +433,7 @@ def form_for(record, options = {}, &block)
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
4 actionpack/test/template/form_helper_test.rb
@@ -2791,8 +2791,8 @@ def test_form_for_with_labelled_builder_with_nested_fields_for_with_custom_build
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
Please sign in to comment.
Something went wrong with that request. Please try again.