I have a form that allows the user to compose a hash.
The hash of the desired end will be something like this: {1 => "a", 2 => "x", 3 => "m"}
I can create something like this, with many inputs that have internal brackets in their names:
<%= hidden_field_tag "article[1]", :value => a %>
However, the end result is that it builds a hash where all the keys are strings, not integers:
{"1" => "a", "2" => "x", "3" => "m"}
I am currently fixing this by creating a new hash in the controller, sorting through the input hash, and then assigning it to the parameters. Is there a cleaner, DRYer way to do this?
source
share