Create a deep copy of the recording?

I need to be able to copy the entry. By this I mean: all links must be deeply copied.

For example, if I have a case and he has a patient who contacts the patient, copying the case also means making a copy of the patient.

Therefore, what would be the "best methods" for this. My first thought was to create a create_copy method for all of my models and each of these calls, which creates a cascading deep copy for all of their dependencies.

I'm just wondering if there is a "rails" way for this where I could add a clone function?

+3


source to share


1 answer


You can try the Amoeba gem try it.

Link: fooobar.com/questions/198939 / ...



Also deep_clonable .

They both work with Rails 4 and have recently been updated.

+3


source







All Articles