I have a user model that can have one album. Album can have multiple photos. How do I create nested resources for these three models? How do you avoid nesting more than two levels? All the examples I have seen only have nesting with two levels. TIA. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 7/1/07, bcparanj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <bcparanj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I have a user model that can have one album. Album can have multiple > photos. How do I create nested resources for these three models? How > do you avoid nesting more than two levels? > > All the examples I have seen only have nesting with two levels. TIA.You can nest as deeply as you want. -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.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 -~----------~----~----~----~------~----~------~--~---
bcparanj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jul-02 03:33 UTC
Re: Nested Resources
I have: map.resources :users do |user| user.resource :album do |album| album.resources :photos end end Should I use the singular resource for my case?Thanks. On Jul 1, 11:07 am, "Rick Olson" <technowee...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 7/1/07, bcpar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <bcpar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I have a user model that can have one album. Album can have multiple > > photos. How do I create nested resources for these three models? How > > do you avoid nesting more than two levels? > > > All the examples I have seen only have nesting with two levels. TIA. > > You can nest as deeply as you want. > > -- > Rick Olsonhttp://lighthouseapp.comhttp://weblog.techno-weenie.nethttp://mephistoblog.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 -~----------~----~----~----~------~----~------~--~---
bcparanj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> I have: > > map.resources :users do |user| > user.resource :album do |album| > album.resources :photos > end > end > > Should I use the singular resource for my case?Thanks.From the ri documentation for "resource": See map.resources for general conventions. These are the main differences: - a singular name is given to map.resource. The default controller name is taken from the singular name. - To specify a custom plural name, use the :plural option. There is no :singular option - No default index, new, or create routes are created for the singleton resource controller. - When nesting singleton resources, only the singular name is used as the path prefix (example: ''account/messages/1'') -- 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 -~----------~----~----~----~------~----~------~--~---