Hi you all,
I’m doing a REST app where some of the URLs are difficult to do it with
map.resources, so I’ve still creating them with map.connect and named
routes.
So in routes.rb I have this:
map.bugs_by “bugs/by/:att/:value”,
:controller => “bugs”, :action => “by”, :att => nil, :value =>nil
map.resources :clients do |clients|
clients.client_bugs_by “bugs/by/:att/:value”,
:controller => “bugs”, :action => “by”, :att => nil, :value
=>nil
end
However, with this code:
<%= link_to ‘Filter’, client_bugs_by_path(@client)%>
I go to the URL http://localhost:3000/bugs/by/{client_id}
That is, it sets the client id in the param :att, not in the :client
one, choosing the first named route, not the one in map.resources
clients
This is strange, cause the route I get with “rake routes” is:
client_sdrs_by /sdrs/by/:att/:value
{:path_prefix=>“/clients/:client_id”, :action=>“by”,
:new_name_prefix=>“client_”, :controller=>“sdrs”}
So… why this does not work?