has_many :through extended with writer and clear methods

I hope this hasn't been asked yet. I couldn't find it if it was.

I've extended the has_many through association to include a clear
method as well as adding a mass assignment for the collection.

I wanted to know if what I am doing is sane and/or if it is redundant
because it is already being worked into rails edge.

The full description and code is at

If there is a better way to handle this, or if there is some reason
that what I'm doing will cause other problems, please let me know.
Otherwise, feel free to use it.


I stumbled across this same issue recently as well. I haven't seen
anything like it in edge. The only difficulty I foresee is associating
objects if one hasn't been saved to the database.

I think a few other changes would be needed in other places to really
take advantage of this. For example, say you have an edit form for
Group and have a list of Users that are joined through Membership. if
you deselect all Users, nothing will get passed through as a parameter
to the update request. In that case, the update_attributes method
should know that getting no Users back as a parameter means to remove
all Users from the Group.

Here is my write up of the problem