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
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, “[email protected]” [email protected]