These are chat archives for flajann2/deep_dive

28th
Jan 2016
Simon Polak
@smnplk
Jan 28 2016 17:23
anyone here ?
I am trying to deep copy nested has_many associations but failing.
I have a job that has_many phases and phase has many categories.
if i do job_copy = @job.ddup it it copies the job objects and references to phases and categories are there in object, but when i do job_copy.save those references are not saved. I know what should be done, the phases need to be copied after the new job is saved and for each copied phase change the job_id to point to job_copy.id..and the same with categoires, I can do this "by hand" programatically, I am just wondering if there is any other way
impedence mismatch :P
Simon Polak
@smnplk
Jan 28 2016 17:30
Well, I am not failing at deep copy, I am failing at saving :P ;)
Guess I'm gonna have to do it 'by hand'