Type of object to copyobj = {
id: 1
models: [
{
id: 1,
parent_id: nil
},
{
id: 2,
parent_id: 1
},
{
id: 3,
parent_id: 1
},
{
id: 4,
parent_id: nil
},
{
id: 5,
parent_id: 4
},
{
id: 6,
parent_id: 4
}
]
}
The object exists of this type.
praent_id is the ID of the same model which is nil.
When you copy it using th...