When I use link_to helper in a Rails 3.0.7 application with many parameters, it generates a lexicographically sorted URL, as is probably mentioned in the to_param method for the Hash in Activesupport documentation. eg.
link_to "my Link", {:u=>"user", :q=>"some query", :page=>"4"}
generates
"/search?page=4&q=some+query&u=user"
but I want
"/search?u=user&q=some+query&page=4"
Anyone who can do the custom sort specified in the hash options to link_to or url_for?
If something is missing for me, it seems to contradict the example given in the documentation for link_to (either ri link_to , or in the file /gems/actionpack-3.0.7/lib/action_view/helpers/url_helper.rb:215
# link_to "Nonsense search", searches_path(:foo => "bar", :baz => "quux")
Of course, I can create a manual URL creation like
link_to "my Link", "/search?u=#{user}&q=#{query}&page=#{page}"
but this will be missing the โRails pathโ and has some problems when escaping certain characters, so this will be the last option.
kanny source share