diff options
author | Jeff Dean <jeff@zilkey.com> | 2010-06-11 20:25:58 -0400 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2010-06-23 16:23:54 +1200 |
commit | ac8d3e3acabf3ece495f591a7195d794d6c611e1 (patch) | |
tree | 6363c272e2c70b87556d2897957c2a9cb3ff425d /actionpack/lib/action_view | |
parent | e639536ea80e94f5d72493267c8aec21d305cf74 (diff) | |
download | rails-ac8d3e3acabf3ece495f591a7195d794d6c611e1.tar.gz rails-ac8d3e3acabf3ece495f591a7195d794d6c611e1.tar.bz2 rails-ac8d3e3acabf3ece495f591a7195d794d6c611e1.zip |
make text_field and hidden_field omit the value attribute if the developer explicitly passes in :value => nil [#4839 state:resolved]
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index d44bae9c3e..2bbe11fef2 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -898,7 +898,7 @@ module ActionView options.delete("size") end options["type"] ||= field_type - options["value"] ||= value_before_type_cast(object) unless field_type == "file" + options["value"] = options.fetch("value"){ value_before_type_cast(object) } unless field_type == "file" options["value"] &&= html_escape(options["value"]) add_default_name_and_id(options) tag("input", options) @@ -1043,14 +1043,14 @@ module ActionView def add_default_name_and_id(options) if options.has_key?("index") options["name"] ||= tag_name_with_index(options["index"]) - options["id"] = options.fetch("id", tag_id_with_index(options["index"])) + options["id"] = options.fetch("id"){ tag_id_with_index(options["index"]) } options.delete("index") elsif defined?(@auto_index) options["name"] ||= tag_name_with_index(@auto_index) - options["id"] = options.fetch("id", tag_id_with_index(@auto_index)) + options["id"] = options.fetch("id"){ tag_id_with_index(@auto_index) } else options["name"] ||= tag_name + (options.has_key?('multiple') ? '[]' : '') - options["id"] = options.fetch("id", tag_id) + options["id"] = options.fetch("id"){ tag_id } end end |