Join model with attributes

Hi,

Is there a supported / preferred way to create join model objects with attributes, when using collection<<, collection.create, etc?, I.e. similar to how John Susser suggested here:

http://blog.hasmanythrough.com/2006/8/19/magic-join-model-creation

His method doesn’t work directly in Rails 2.1.0 since with_scope is protected.

I’d basically like a way to define a HM:T relation with a condition & default parameter for attribute of the join model. The condition is possible using

has_many things, :through => “joinmodel”, :condition => { “joinmodel.attribute” => “value” }

but object.things<<(related), results in an exception since it requires a value for for attribute on the join model.

Suggestions?

Lars

I've been struggling with the same thing the last couple days. Everyone is raving about the new named_scoped, which is very cool for _finds_, but would be even better for creates also.