I got two tables, books and words.
A book has many words.
However a work is not belong to a book, because a word can be used in different book.
Which association is right for this case?
Many thanks for reply.
I got two tables, books and words.
A book has many words.
However a work is not belong to a book, because a word can be used in different book.
Which association is right for this case?
Many thanks for reply.
has_and_belongs_to_many
or use an explicit join table and has_many :through.
See the Rails Guide on ActiveRecord Associations for the basics of using various associations.
Colin
Hi Colin,
I got it, many thanks.
Vincent