aboutsummaryrefslogtreecommitdiffstats
path: root/Rakefile
diff options
context:
space:
mode:
authorclaudiob <claudiob@gmail.com>2014-09-29 00:20:32 -0700
committerclaudiob <claudiob@gmail.com>2014-10-15 09:41:24 -0700
commita9050e71bf0da9fd76f5c71abab250549b3b3a45 (patch)
treea52a7e25deb85459b5e6e3cb0b473211a9590f9e /Rakefile
parente3207bdbba55f3806441f22b175557579bc0b051 (diff)
downloadrails-a9050e71bf0da9fd76f5c71abab250549b3b3a45.tar.gz
rails-a9050e71bf0da9fd76f5c71abab250549b3b3a45.tar.bz2
rails-a9050e71bf0da9fd76f5c71abab250549b3b3a45.zip
Remove duplicate stringify_keys in text_field_tag
All the methods that invoke `text_field_tag` (such as `hidden_field_tag`) and all the methods that invoke `number_field_tag` (that is `range_field_tag`) do not need to call `stringify_keys` on their `options` parameter since the `text_field_tag` method [is already doing it internally](https://github.com/claudiob/rails/blob/4159134524f4c78d008eef9d9a17f73a3172dcc8/actionview/lib/action_view/helpers/form_tag_helper.rb#L182): ```ruby def text_field_tag(name, value = nil, options = {}) tag :input, { "type" => "text", "name" => name, "id" => sanitize_to_id(name), "value" => value }.update(options.stringify_keys) end ``` and `number_field_tag` is [already doing it internally](https://github.com/claudiob/rails/blob/e3207bdbba55f3806441f22b175557579bc0b051/actionview/lib/action_view/helpers/form_tag_helper.rb#L780) as well: ```ruby def number_field_tag(name, value = nil, options = {}) options = options.stringify_keys ... end [Note #1: My code uses `merge` to respect the existing behavior of duplicating the `options` hash before updating its keys, see https://github.com/rails/rails/pull/17096#issuecomment-57223827] [Note #2: My code uses symbols instead of strings (e.g.: `:hidden`) to look forward to future version of Ruby/Raiks (GC symbols); the result of the method, however, is the same, because the symbols are stringified inside `text_field_tag`] [Note #3: I had previously created a similar PR #17096 but decided to split it into multiple PRs given the feedback received in the comments]
Diffstat (limited to 'Rakefile')
0 files changed, 0 insertions, 0 deletions