julio.ademar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Feb-10 20:22 UTC
has_and_belongs_to_many with 4 tables
Hi everyone, i am new to this group, hope someone can help me. Suppose a DB schema with the following tables: users, documents, sections, documents_sections_users How can i implement the has_and_belongs_to_many here? Rails doesn''t seem to extract the dependencies :\ Thanks everyone --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
julio.ademar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Feb-11 13:10 UTC
Re: has_and_belongs_to_many with 4 tables
bump! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi, It should be from what I guess (you need to give more details): class User < AR has_and_belongs_to_many :documents end class Document < AR has_and_belongs_to_many :users has_and_belongs_to_many :sections end class Section < AR has_and_belongs_to_many :documents end and the tables are users, documents, sections, documents_users, documents_sections On 11 fév, 14:10, "julio.ade...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <julio.ade...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> bump!--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---