rails/rails — pull request #17096 by claudiob (2014-09-29 07:33:53+00:00)
Title: Remove stringify keys

A set of `stringify_keys` was introduced 9 years ago in dfac1cea to fix helpers that would treat string and symbol keys differently and possibly create duplicate entries.

Currently Rails requires versions of Ruby >= 1.9; this means that Hashes preserve the keys in the order in which they were inserted.

For this reason, there is no need to stringify keys anymore. Even if someone were to write code like:

```rhtml
<%= time_field_tag 'timestamp', 1200, "type" => "password" %>
```

then a simple `options.update` (without `stringify_keys`) would generate the temporary hash `{"type"=>"password", type: :time}` which, passed to `text_field_tag`, would result in:

```html

```

In fact [`text_field_tag` **already invokes** `stringify_keys` on its options](https://github.com/rails/rails/blame/482e80e84440136763b47c0fba2ed65a7823f022/actionview/lib/action_view/helpers/form_tag_helper.rb#L182) and `type: :time` is the last assigned option.

---

Additionally, this commit also changes the syntax of the options passed, switching from Strings to Symbols.
Because of what explained above (`text_field_tag` already invokes `stringify_keys` on those options), this does not have any affect on the (performance of) the code, but it's (in my opinion) more coherent and looking forward to new versions of Ruby/Rails.

If you feel that the PR makes sense, but you'd like to keep the String syntax, let me know and I'll update the PR accordingly! Thanks :lollipop: