Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove size attribute from tag generated by file_field helper [#5084

…state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
commit d2fae5f78efd7123b9ce633933f77cbe0e0711a9 1 parent b520d60
Miles Egan authored josevalim committed
View
2  actionpack/lib/action_view/helpers/form_helper.rb
@@ -676,7 +676,7 @@ def hidden_field(object_name, method, options = {})
# # => <input type="file" id="attachment_file" name="attachment[file]" class="file_input" />
#
def file_field(object_name, method, options = {})
- InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("file", options)
+ InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("file", options.update({:size => nil}))
end
# Returns a textarea opening and closing tag set tailored for accessing a specified attribute (identified by +method+)
View
5 actionpack/test/template/form_helper_test.rb
@@ -200,6 +200,11 @@ def test_text_field_doesnt_change_param_values
assert_equal object_name, "post[]"
end
+ def test_file_field_has_no_size
+ expected = '<input id="user_avatar" name="user[avatar]" type="file" />'
+ assert_dom_equal expected, file_field("user", "avatar")
+ end
+
def test_hidden_field
assert_dom_equal '<input id="post_title" name="post[title]" type="hidden" value="Hello World" />',
hidden_field("post", "title")
Please sign in to comment.
Something went wrong with that request. Please try again.