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

remove size attribute from tag generated by file_field helper [#5084 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
Miles Egan 2010-07-11 10:43:41 -07:00 committed by José Valim
parent b520d602ff
commit d2fae5f78e
2 changed files with 6 additions and 1 deletions

View file

@ -676,7 +676,7 @@ module ActionView
# # => <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 file

@ -200,6 +200,11 @@ class FormHelperTest < ActionView::TestCase
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")