Brian V. Hughes wrote:
Josh S. wrote:
There is no recommended way to update attributes on a habtm association.
In fact, rich associations (habtm with attributes) have been deprecated
and won’t be supported at all come 2.0 release. Use a join model
(has_many :through) instead.
Correct me if I’m wrong, but these are technically called “polymorphic
aren’t they? I would recommend we try to use the right terms when we
that hopefully everyone is on the same page. Saying just “use a join
easily means more than one thing, just in a Rails context, doesn’t it?
Brian, I don’t think Henrik was talking about polymorphism. The usual
habtm join table has nothing to do with polymorphism, and I’m not sure
how to make it work with polymorphic associations anyway.
I’m pretty sure I was using the right terminology. In Rails parlance a
“join model” is a join table that has been promoted to full model status
by adding a primary key and probably other attribute fields as well. It
also has a Model class, which habtm join tables don’t, so its table name
corresponds to its model name in the usual fashion, rather than being
constructed from names of the tables it is joining.
You can use polymorphic associations in a join model, but it gets
tricky. I just blogged about that a couple days ago in fact.