Wes G. wrote:
I’ve heard recently about has_many :through as a necessary alternative
to HABTM (when the join table has it’s own id column, say, in a legacy
schema). However, is the prevailing Rails wisdom now that one should
use has_many :through in all cases?
Not at all.
Think about the model first. Do you want to model your associations
explicitly, using a model class? In other words, are there things that
you want to say about the associations? (Can you put a name to them?
This may help you to find things that you might want to say about them.)
If so, use a model for the association… and then you will need the
:through capability to let you navigate through the association in a
If you just want the association to exist, with nothing further being
said about it, stick with HABTM.
In other words, I agree with others in this thread, but would like to
put the emphasis on thinking carefully about the domain model.