diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-07-24 08:53:57 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-07-24 08:53:57 -0700 |
commit | 82a76dfd188223f2856fd92568f51e088be44f31 (patch) | |
tree | 4e7c1278b45a7a128d1e3e0b0b945a7119ab9930 /actionview/lib | |
parent | 3a4d0b1e2975122defe86de31fc35ab2dcd9b984 (diff) | |
parent | 1424873948a98ab30ac4b5eed35d3de59a54b92a (diff) | |
download | rails-82a76dfd188223f2856fd92568f51e088be44f31.tar.gz rails-82a76dfd188223f2856fd92568f51e088be44f31.tar.bz2 rails-82a76dfd188223f2856fd92568f51e088be44f31.zip |
Merge pull request #11570 from joelcogen/harmonize_text_field_and_area
text_area should handle nil value option like text_field
Diffstat (limited to 'actionview/lib')
-rw-r--r-- | actionview/lib/action_view/helpers/tags/text_area.rb | 2 | ||||
-rw-r--r-- | actionview/lib/action_view/helpers/tags/text_field.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/actionview/lib/action_view/helpers/tags/text_area.rb b/actionview/lib/action_view/helpers/tags/text_area.rb index c81156c0c8..9ee83ee7c2 100644 --- a/actionview/lib/action_view/helpers/tags/text_area.rb +++ b/actionview/lib/action_view/helpers/tags/text_area.rb @@ -10,7 +10,7 @@ module ActionView options["cols"], options["rows"] = size.split("x") if size.respond_to?(:split) end - content_tag("textarea", options.delete('value') || value_before_type_cast(object), options) + content_tag("textarea", options.delete("value") { value_before_type_cast(object) }, options) end end end diff --git a/actionview/lib/action_view/helpers/tags/text_field.rb b/actionview/lib/action_view/helpers/tags/text_field.rb index baa5ff768e..e910879ebf 100644 --- a/actionview/lib/action_view/helpers/tags/text_field.rb +++ b/actionview/lib/action_view/helpers/tags/text_field.rb @@ -5,8 +5,8 @@ module ActionView def render options = @options.stringify_keys options["size"] = options["maxlength"] unless options.key?("size") - options["type"] ||= field_type - options["value"] = options.fetch("value"){ value_before_type_cast(object) } unless field_type == "file" + options["type"] ||= field_type + options["value"] = options.fetch("value") { value_before_type_cast(object) } unless field_type == "file" options["value"] &&= ERB::Util.html_escape(options["value"]) add_default_name_and_id(options) tag("input", options) |