From: Cameron McBride Date: 2005-02-13T12:38:11+09:00 Subject: Re: Rails: has_and_belongs_to_many Greetings, > I am experimenting with Rails, and I have the following question regarding > ActiveRecord. first off, the rails list might usually be more helpful (quicker) with rails questions rather than ruby-talk. > If I want to model a situation where a many to many relationship has some > fields associated with it, is there any way to do it with ActiveRecord? > > For instance, if several stores have product inventory I would have a many > to many relation between the "products" table and the "stores" table, with > the quantity stored in the table "stores_products". um, yes. but like your subject says, it's the has_and_belongs_to_many part that does EXACTLY what you're talking about. in good faith, here is the link: http://ar.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#M000011 or look at the 'associations.rb' in the examples directory of AR. Cameron