From d2fae5f78efd7123b9ce633933f77cbe0e0711a9 Mon Sep 17 00:00:00 2001 From: Miles Egan Date: Sun, 11 Jul 2010 10:43:41 -0700 Subject: [PATCH] remove size attribute from tag generated by file_field helper [#5084 state:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- actionpack/lib/action_view/helpers/form_helper.rb | 2 +- actionpack/test/template/form_helper_test.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 6302491c2a..711c455ded 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -676,7 +676,7 @@ module ActionView # # => # 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+) diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 4b9e41803f..9ddfa13c16 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -200,6 +200,11 @@ class FormHelperTest < ActionView::TestCase assert_equal object_name, "post[]" end + def test_file_field_has_no_size + expected = '' + assert_dom_equal expected, file_field("user", "avatar") + end + def test_hidden_field assert_dom_equal '', hidden_field("post", "title")