swachian
2008-Sep-03 04:51 UTC
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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Franz Strebel
2008-Sep-03 07:44 UTC
Re: how can i disable the named routes generated in a nestes route
On Wed, Sep 3, 2008 at 6:51 AM, swachian <zhangyu34-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
swachian
2008-Sep-04 13:52 UTC
Re: how can i disable the named routes generated in a nestes route
thanks. it''s working now. On Sep 3, 3:44 pm, "Franz Strebel" <franz.stre...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Wed, Sep 3, 2008 at 6:51 AM, swachian <zhangy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---