Rails 3: difference between has_many :through and has_and_belongs_to_many

posted by Arkham on May 24th, 2011

From Rails guides:

The simplest rule of thumb is that you should set up a has_many :through relationship if you need to work with the relationship model as an independent entity. If you don’t need to do anything with the relationship model, it may be simpler to set up a has_and_belongs_to_many relationship (though you’ll need to remember to create the joining table in the database).

Tags: , , ,