active_fedora icon indicating copy to clipboard operation
active_fedora copied to clipboard

related_objects.delete should return deleted object (not array) or nil

Open elrayle opened this issue 10 years ago • 1 comments

When the following code is used to remove a related object from a collection/object, it has unexpected behaviors.

parent_collection.related_objects.delete child_related_object
  • if child_related_object is present and deleted - CURRENT: returns [child_related_object] DESIRED: return child_related_object
  • if child_related_object is missing, but other related objects exist - returns [child_related_object]; should return child_related_object CURRENT: returns [child_related_object] DESIRED: return nil
  • if related objects is empty CURRENT: raises error - ActiveFedora::ObjectNotFoundError: Can't reload an object that hasn't been saved DESIRED: return nil

elrayle avatar May 18 '15 20:05 elrayle

Originally posted at https://github.com/projecthydra-labs/activefedora-aggregation/issues/36 with discussions that may be of help in understanding this issue.

elrayle avatar May 18 '15 20:05 elrayle