lib/mongoid/association/referenced/has_one/buildable.rb in mongoid-7.2.0.rc1 vs lib/mongoid/association/referenced/has_one/buildable.rb in mongoid-7.2.0
- old
+ new
@@ -33,9 +33,17 @@
end
private
def clear_associated(object)
+ unless inverse
+ raise Errors::InverseNotFound.new(
+ @owner_class,
+ name,
+ object.class,
+ foreign_key,
+ )
+ end
if object && (associated = object.send(inverse))
associated.substitute(nil)
end
end