Permalink
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...
2 parents be1a7eb + 3ab7ddb commit e4807f0812d4b49a1a2b5c8e3c0bb5a2062c1151 @carlosantoniodasilva carlosantoniodasilva committed Mar 17, 2013
@@ -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
@@ -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

0 comments on commit e4807f0

Please sign in to comment.