jeudi 8 novembre 2018

Rails delete all associations on duplicated object

When duplicating an object with object_dup=object.dup all associations are also copied.

object_dup.foos == object.foos

I would like to destroy all duplicated associations on object_dup. It might be easier to just create a new object. But the duplication saves me from property-setting-hell ;) I would like to duplicate/clone only object itself without the associations or delete them all after the creation. Is that possible?

Aucun commentaire:

Enregistrer un commentaire