Hello,
I posted a message about this previously on the prototype core board (http://groups.google.com/group/prototype-core/browse_thread/thread/107f1dafddb773d7), but I'm now thinking the issues lies in Rails.
This issue came about with recent fixes to Array.to_query. One of the related tickets is http://dev.rubyonrails.org/changeset/6343.
I think the issue lies with a call to CGI::escape somewhere within rails. Basically the issue is the following...
<%= url_for(:controller => 'test', :action => 'auto_complete_for_test', :field => %w(a b c)) %> generates... '/test/auto_complete_for_test?field%5B%5D=a&field%5B%5D=b&field%5B%5D=c'
The &'s get substituted to & in the html normally producing the correct url for rails to parse. This is fine for urls generated within "normal" html, but when used within a <script> tag, the & doesn't get substituted back into a single &. So for urls generated within a script tag like those with auto_complete_field for example, the url is incorrect.
This is how rails receives the data when the url resides in a script tag (note the "field" and "amp;field" params)...
Processing TestController#auto_complete_for_test (for 127.0.0.1 at 2007-10-14 18:21:22) [POST] Parameters: {"action"=>"auto_complete_for_test", "field"=>["a"], "controller"=>"test", "amp;field"=>["b", "c"], "test"=>"test"}
I would have expected an issue like this to have popped up before (and maybe it has and been fixed), but it's occuring in the latest 1.2.5 release at least now.
So to summarize...
no issues with this alone... url_for(:controller => 'test', :action => 'auto_complete_for_test', :field => %w(a b c))
but this causes a problem... <%= javascript_tag url_for(:controller => 'test', :action => 'auto_complete_for_test', :field => %w(a b c)) %>
Is this an issue that has come up before?
Thanks, Andrew