Has_many :through troubles


Hi list

I have a question related to an has_many :through association.
Basicly I have a form that updates the entire has_many :through
collection AND the parent object.

from the form I have:

params[:parentobject] (all the attributes related to the parent object)



an array of all the destination ID of the has many through association

How can I cleanly (and maybe atomicly since I’m using postgres)
destroy and create the needed records in the join table within the
update statement of the parent?