HABTM vs Has Many

Hi,

Just wondering what the recommended practice is for creating a
many-to-many relationship between two tables when the join table must
store additional data beyond just the ids of the joined tables.

for example if you have tables, albums and artists and you wanted a
join table with an additional field "year".

so you'd have schemas:

albums

You are looking for has_many :through relationship. Look up how to do a
has_many :through and you will find all you need. This might make the
relationships clearer:

http://mboffin.com/stuff/ruby-on-rails-data-relationships.png