Hi there
I need to store additional attributes on join table. Searching the
Wiki [1] revealed two possible methods:
-
push_with_attributes, as described by Justin Palmer [2].
Unfortunately, “this method is now deprecated” [3]. Even if it wasn’t,
there seem to be inherent problems with that approach, for example
with updating those additional attributes, though Joshua M. have
provided us with a plugin for that [4]. -
promote the join-table to a full module. This approach seems to
integrate better with Rails, and even a newb like me can sense that it
has a lesser chance of rubbing ActiveRecord’s magic the wrong way,
thereby breaking something. Still, that habtm association is just an
association, not a model. I wouldn’t want to make it a model if I
could help it.
So, what’s the best practice for storing additional data on join
tables with Rails?
-Alder
[1] Peak Obsession
[2]
http://encytemedia.com/blog/articles/2005/06/15/storing-additional-data-on-join-tables-with-rails#comment-490
[3]
Peak Obsession
[4]
Peak Obsession