# How can i disable the named routes generated in a nestes route

**URL:** <https://www.ruby-forum.com/t/how-can-i-disable-the-named-routes-generated-in-a-nestes-route/147573>\
**Category:** Rails\
**Created:** [September 3, 2008, 8:15am UTC](https://www.ruby-forum.com/t/how-can-i-disable-the-named-routes-generated-in-a-nestes-route/147573 "2008-09-03T08:15:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![swachian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ea666f/32.png) [@swachian](https://www.ruby-forum.com/u/swachian)\
**Post date:** [September 3, 2008, 8:15am UTC](https://www.ruby-forum.com/t/how-can-i-disable-the-named-routes-generated-in-a-nestes-route/147573/1 "2008-09-03T08:15:48Z")

</div>

in routes.rb, code like :  
map.resources :users do |user|  
user.resources :addressbooks  
end

will generate routes like ‘/users/1/addressbooks/1’ and ‘/addressbooks/  
1’.  
My question is that how i can disable the later route? and only make  
the former( ‘/users/1/addressbooks/1’) work.

---

<div class="post-metadata">

**Author:** ![swachian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ea666f/32.png) [@swachian](https://www.ruby-forum.com/u/swachian)\
**Post date:** [September 3, 2008, 9:44am UTC](https://www.ruby-forum.com/t/how-can-i-disable-the-named-routes-generated-in-a-nestes-route/147573/2 "2008-09-03T09:44:51Z")

</div>

On Wed, Sep 3, 2008 at 6:51 AM, swachian [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> My question is that how i can disable the later route? and only make  
> the former( ‘/users/1/addressbooks/1’) work.

That route is available via the default routes installed by Rails  
at the bottom of routes.rb

# Install the default routes as the lowest priority.

map.connect ‘:controller/:action/:id’  
map.connect ‘:controller/:action/:id.:format’

You can comment those out but be careful to add :collection and :member  
parameters to your resource mappings if you use custom actions.

Franz

---

<div class="post-metadata">

**Author:** ![swachian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ea666f/32.png) [@swachian](https://www.ruby-forum.com/u/swachian)\
**Post date:** [September 4, 2008, 3:53pm UTC](https://www.ruby-forum.com/t/how-can-i-disable-the-named-routes-generated-in-a-nestes-route/147573/3 "2008-09-04T15:53:06Z")

</div>

thanks. it’s working now.
