I have seen the new way to define RESTful routes. How would you define the following routes in the newstyle? map.resources :dinners do |dinner| dinner.resources :dishes do |dish| dish.resources :side_courses end end Any ideas? Thanks! Chris -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Chris Williams wrote:> I have seen the new way to define RESTful routes. How would you define > the following routes in the newstyle? > > map.resources :dinners do |dinner| > dinner.resources :dishes do |dish| > dish.resources :side_courses > end > end > > Any ideas?That''s totally current and up-to-date for Rails 2.0. If by "new way" you mean the :has_many and :has_one options, those are just shortcuts for nesting resources or singular resource, respectively. I don''t think you can do multiple levels that way though. -- Josh Susser http://blog.hasmanythrough.com -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
The :has_one and :has_many are the shortcuts I was eluding to. Just making sure I am doing things the correct way with Rails 2.0. Thanks Chris Josh Susser wrote:> Chris Williams wrote: >> I have seen the new way to define RESTful routes. How would you define >> the following routes in the newstyle? >> >> map.resources :dinners do |dinner| >> dinner.resources :dishes do |dish| >> dish.resources :side_courses >> end >> end >> >> Any ideas? > > That''s totally current and up-to-date for Rails 2.0. If by "new way" > you mean the :has_many and :has_one options, those are just shortcuts > for nesting resources or singular resource, respectively. I don''t think > you can do multiple levels that way though. > > -- > Josh Susser > http://blog.hasmanythrough.com-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---