moiristo / deep_cloneable

This gem gives every ActiveRecord::Base object the possibility to do a deep clone that includes user specified associations.
MIT License
785 stars 89 forks source link

how to use deep_clone in has_ancestry relation #80

Closed rajeevkhangar closed 7 years ago

rajeevkhangar commented 7 years ago

please look into this. https://github.com/stefankroes/ancestry

I would like to keep ancestry data as well when I am going to deep clone and ancestry column value should
be changed during deep cloning.

Please suggest me what should i do.

moiristo commented 7 years ago

I don't think that's possible, as the hierarchy is not defined via an association. However, I think you could work around it by specifying the optional block. What I would do is something like the following:

I hope you can find a solution for this. It would be nice if you could share it with us when you do ;)