Closed NarasimhaReddyY closed 5 years ago
Hi,
I think it is, this is related to #22. I think you should clone via the through association instead:
Model.find(1).deep_clone include: { another: :something }
@moiristo Tried both before raising a issue here. Those solutions seems to not working with the versions i provided. Please take a look into it. Thanks.
When i try Model.find(1).deep_clone include: { anothers: :somethings }
it's raising a exception ActiveRecord::Base::DeepCloneable::AssociationNotFoundException: Another#somethings
I'm closing this. Based on your last message, I think this was not a deep_cloneable issue and was probably caused by incorrectly defined associations.
Hello,
I observed one thing while cloning nested associations. Whenever am trying to clone a
has_many through
association,deep_clone
instead creating new association objects, it just assigning association records of original record to cloned record.ex:- if
Model
has associationhas_many: :somethings, through: :anothers
here let's saySomething.count == > 10
if i do
clone = Model.find(1).deep_clone include: [:somethings]
clone.save!
after cloning alsoSomething.count == 10
Is it a intented functionality or bug? Thanks
FYI:
ruby - 2.3.3p222 Rails - 4.2.4 deep_clonable - 2.2.2