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

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.

On Wed, Sep 3, 2008 at 6:51 AM, swachian [email protected] 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

thanks. it’s working now.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs