Which association is right for books table and words table?

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.

On 6 January 2012 20:07, Taiwan Vincent
[email protected] wrote:

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?

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs