While searching some documentation about has_many :through I’ve found Josh Susser’s blog called (very imaginatively) “has_many :through” and the article about Magic join model creation in Rails Edge.
It is about using << on has_many through associations, before that you could use them only on habtm.
The article is quite old, 19 August 2006, and Rails has changed a bit since then, with_scope is now protected so now instead of
Contribution.with_scope(:create => join_attrs) { self << book }
use
Contribution.send(:with_scope, :create => join_attrs) { self << book }
For more information about many-to-many associations also see Many-to-many Dance-off in which habtm and has_many through is compared and Rails documentation.
Trying to get this to work on Rails 3.0. I can throw up a testapp on Github for you to look at. Would love your help.
Comment by Alexis M — December 5, 2010 @ 6:17 am
Please join the conversation here http://stackoverflow.com/questions/5363702/has-many-through-additional-attributes/6661404#6661404
Comment by jibiel — July 12, 2011 @ 10:30 am