If an ActiveRecord instance is cloned, this keeps track of errors of this 'parent', because both errors instances point to the same ActiveModel::Errors instance. This happen when before to call dup, save or valid? is called
I think you could probably only set @errors to nil, and let the method do its job.
yes, it works also and is much clear
but should be better that @errors is cloned also ?
Also, I think this should be fixed in Active Model instead, because it's not only specific to Active Record, ie any class using ActiveModel::Validations would have the same possible issue not?
yes is specific only to ActiveRecord dup, where can I verify or apply this possible issue?
I think you just need to recreate the test under ActiveModel.
It's possible to just set @errors = nil, and avoid the variable.
@errors = nil
👍 for moving to active model and cloning the errors object as well
ActiveRecord dup, create a new ActiveModel::Errors istance, in one co…
…mmit, fixed #5953