Mike C
2008-Jun-22 21:47 UTC
How to define routes for resource that belongs to multiple resources?
Say I have resource comment that belongs to resources post and blog. I know that to nest comment into say, post would look like this: map.resources :posts do |post| post.resources :comments end However, if I wanted :comments to also belong to :blogs, how would I do that? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Matt Darby
2008-Jun-23 01:03 UTC
Re: How to define routes for resource that belongs to multiple resources?
On Jun 22, 5:47 pm, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Say I have resource comment that belongs to resources post and blog. I > know that to nest comment into say, post would look like this:What you''re really looking for is called Polymorphic Associations: http://wiki.rubyonrails.org/rails/pages/UnderstandingPolymorphicAssociations --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mike C
2008-Jun-23 01:39 UTC
Re: How to define routes for resource that belongs to multiple resources?
Thanks a bunch! :) On Jun 22, 6:03 pm, Matt Darby <m...-0eUD8CxtpZOb3c84sXp8cg@public.gmane.org> wrote:> On Jun 22, 5:47 pm, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Say I have resource comment that belongs to resources post and blog. I > > know that to nest comment into say, post would look like this: > > What you''re really looking for is called Polymorphic Associations:http://wiki.rubyonrails.org/rails/pages/UnderstandingPolymorphicAssoc...--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mike C
2008-Jun-27 23:11 UTC
Re: How to define routes for resource that belongs to multiple resources?
Actually I just read through that and while it''s useful, I still want to know the syntax for defining such relationships. On Jun 22, 6:39 pm, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks a bunch! :) > > On Jun 22, 6:03 pm, Matt Darby <m...-0eUD8CxtpZOb3c84sXp8cg@public.gmane.org> wrote: > > > On Jun 22, 5:47 pm, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Say I have resource comment that belongs to resources post and blog. I > > > know that to nest comment into say, post would look like this: > > > What you''re really looking for is called Polymorphic Associations:http://wiki.rubyonrails.org/rails/pages/UnderstandingPolymorphicAssoc...--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---