lib/mongoid/association/referenced/has_one/nested_builder.rb in mongoid-7.2.6 vs lib/mongoid/association/referenced/has_one/nested_builder.rb in mongoid-7.3.0
- old
+ new
@@ -67,11 +67,11 @@
#
# @return [ true, false ] If the id part of the logic will allow an update.
#
# @since 2.0.0
def acceptable_id?
- id = convert_id(existing.class, attributes[:id])
+ id = convert_id(existing.class, attributes[:_id])
existing._id == id || id.nil? || (existing._id != id && update_only?)
end
# Can the existing association be deleted?
#
@@ -80,10 +80,10 @@
#
# @return [ true, false ] If the association should be deleted.
#
# @since 2.0.0
def delete?
- destroyable? && !attributes[:id].nil?
+ destroyable? && !attributes[:_id].nil?
end
# Can the existing association potentially be destroyed?
#
# @example Is the object destroyable?