lib/mongoid/association/referenced/has_one/proxy.rb in mongoid-7.1.11 vs lib/mongoid/association/referenced/has_one/proxy.rb in mongoid-7.2.0.rc1

- old
+ new

@@ -52,17 +52,12 @@ # # @return [ One ] The association. # # @since 2.0.0.rc.1 def substitute(replacement) - # If the same object currently associated is being assigned, - # rebind the association and save the target but do not destroy - # the target. - unbind_one if persistable? - # TODO can this entire method be skipped if self == replacement? - if _association.destructive? && self != replacement + if _association.destructive? send(_association.dependent) else save if persisted? end end