Hi James, you can use something like this to get nested params. But I guess you're right, it would be nice to have the nested hashes syntax working as expected.
... params: { 'some_model[attribute_name]' => 'the value' } .... Am Freitag, 12. September 2014 00:01:05 UTC+2 schrieb James Coleman: > > In this commit > <https://github.com/rails/rails/commit/e6e0579defcfcf94ef1c4c1c7659f374a5335cdb> > the > `params` option was added to the `button_to` helper. However, the patch > doesn't support nested hashes so `{a: {b: 'c'}}` for example gets turned > into a hidden form input with the name 'a' and the value being the string > representation of the `{b: 'c'}` nested hash. > > Since Rails supports nested hashes everywhere else (and even in the URL > params of link_to and button_to), I believe this to be a bug/unfinished > feature. Unless the other disagree with that assessment, I'm planning to > submit a patch to add the missing functionality. > > I had question though on implementation: I can't find any support in Rails > for turning a nested hash into a list of name/value pairs for form inputs. > `to_query` exists on Hash, of course, but it specifically escapes the keys > and joins the keys and values as fits a URI. In my patch I can either write > one-off code within the button_to helper to accomplish what I need, or I > can add a new Hash extension to ActiveSupport. What's the best/expected way > to go about tackling this issue? > > Thanks, > James > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.