# How to configure nested routers to omit controller from URL?

**URL:** <https://www.ruby-forum.com/t/how-to-configure-nested-routers-to-omit-controller-from-url/184696>\
**Category:** Rails\
**Created:** [March 6, 2010, 11:26pm UTC](https://www.ruby-forum.com/t/how-to-configure-nested-routers-to-omit-controller-from-url/184696 "2010-03-06T23:26:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![interactivenyc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85f322/32.png) [@interactivenyc](https://www.ruby-forum.com/u/interactivenyc)\
**Post date:** [March 6, 2010, 11:26pm UTC](https://www.ruby-forum.com/t/how-to-configure-nested-routers-to-omit-controller-from-url/184696/1 "2010-03-06T23:26:26Z")

</div>

I have the following nested route in my routes.rb

map.resources :users do |user|  
user.resources :pie\_charts  
end

and the ‘rake routes’ command shows the following routes:

user\_pie\_charts GET /users/:user\_id/pie\_charts(.:format)  
{:controller=\>“pie\_charts”, :action=\>“index”}  
user\_pie\_chart GET /users/:user\_id/pie\_charts/:id(.:format)  
{:controller=\>“pie\_charts”, :action=\>“show”}

This all works, but I want the URLs to omit “/users,” that is:

user\_pie\_charts GET /:user\_id/pie\_charts(.:format)  
user\_pie\_chart GET /:user\_id/pie\_charts/:id(.:format)

Is this possible, and if so how would one go about configuring it?

- Steve W.

---

<div class="post-metadata">

**Author:** ![interactivenyc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85f322/32.png) [@interactivenyc](https://www.ruby-forum.com/u/interactivenyc)\
**Post date:** [March 16, 2010, 12:48pm UTC](https://www.ruby-forum.com/t/how-to-configure-nested-routers-to-omit-controller-from-url/184696/2 "2010-03-16T12:48:02Z")

</div>

Hi,

I have the same problem but I need to omit both users and pie\_charts  
from url… and my pie\_charts has many others nested resources.

If someone know how to do it, please, tell us.

With regards  
Petr Blaho
