Url_for and arrays parameters (diff between 1.1.6 and 1.2.2)


#1

Hello,

I apologize in advance if this has been brought up before, but I tried
searching the previous convos for this and didn’t come up with anything.
I’m wondering if I’m experiencing a bug or expected behavior in the new
release of rails.

In Rails 1.2.2

I’m passing an array to url_for like so…
url_for :controller => ‘test’, :action => ‘list’, :fields => %w(a b c d)

and that generates…
“/test/list?fields=a%2Fb%2Fc%2Fd”

and when I look at my params object in my action fields contains a
string that looks like “a/b/c/d”. Not much of an array there (although
I can split it on the /).

When using Rails 1.1.6, the same url_for call generates…
“/test/list?fields[]=a&fields[]=b&fields[]=c&fields[]=d”

and the params object in my action contains an array like I would
expect.

I’m certain the new routing engine is causing the difference, but is
this a bug? Can somebody please explain why I’m experiencing the
results I am?

Thanks,
Andrew