Nested hash parameters do not work with #link_to

Hi all,

Is it me or should this work:

<%= link_to("link", :a => {:b => 1}) %>

I expected: ?a[b]=1

But instead I get: ?a=b1

b1 is the #to_s form of {:b => 1}.

So, are my expectations wrong, or am I right ? If I'm right, where should I look at to patch Rails ? Just a general pointer would be appreciated.

Thanks !

I tried it on edge Rails. I get what you expected:

ActionController::Routing::Routes.generate({:a => {:b=>1}}, {:controller=>‘con’, :action=>‘act’}) #=> “/con/act?a[b]=1”

See relevant tests: http://dev.rubyonrails.org/browser/trunk/actionpack/test/controller/url_rewriter_test.rb?rev=6380#L168

They were added in [6343]: http://dev.rubyonrails.org/changeset/6343

Hi !

Depends if they consider this a feature or a defect.

If it was "corrected" on trunk, I would think this is a defect that needed correcting. Also [6343] closed three tickets, which would imply this is something that needed work on.

Anyway, wait and see :slight_smile:

Thanks !