# REST: Nesting map.resources and map.connect

**URL:** <https://www.ruby-forum.com/t/rest-nesting-map-resources-and-map-connect/126099>\
**Category:** Rails\
**Created:** [January 15, 2008, 1:03pm UTC](https://www.ruby-forum.com/t/rest-nesting-map-resources-and-map-connect/126099 "2008-01-15T13:03:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![damaris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@damaris](https://www.ruby-forum.com/u/damaris)\
**Post date:** [January 15, 2008, 1:03pm UTC](https://www.ruby-forum.com/t/rest-nesting-map-resources-and-map-connect/126099/1 "2008-01-15T13:03:34Z")

</div>

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}](http://localhost:3000/bugs/by/%7Bclient_id%7D)  
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?
