I sometimes need to pass additional parameters to a page via the URL. I did this in the past with a couple of generic placeholders in the routes file, which I call "genus" and "species". This used to work, but now it has started producing URLs with query strings.
The Rails version is 2.3.8.
The routes file is:
ActionController::Routing::Routes.draw do |map|
map.root :controller => 'main', :action => 'index'
map.connect ':controller', :action => 'index'
map.connect ':controller/:action'
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:genus/:id'
map.connect ':controller/:action/:genus/:species/:id'
end
The index page is:
<p>
<%= url_for :controller => 'main', :action => 'test', :genus => 42, :id => 1 %>
</p>
The test page is
<p>
<%= params.inspect -%>
</p>
The index page shows /main/test?genus=42&id=1 where I would have expected /main/test/42/1.
However, if I go to /main/test/42/1 then I see the correct parameters:
{"controller"=>"main", "action"=>"test", "genus"=>"42", "id"=>"1"}
Any ideas what I'm doing wrong?