Class: Hyrax::Transactions::Steps::AddToCollections
- Inherits:
-
Object
- Object
- Hyrax::Transactions::Steps::AddToCollections
- Defined in:
- lib/hyrax/transactions/steps/add_to_collections.rb
Overview
Add a resource to collections via ‘ChangeSet`.
Accepts ‘:collection_ids` and never retrieves the actual collections from the persisted data. We trust that the identifiers passed refer to actual, extant collections, and that the permissions to add to collection membership have been established, or else that they’ll be validated prior to save.
Instance Method Summary collapse
-
#call(change_set, collection_ids: []) ⇒ Dry::Monads::Result
Add to collections by inserting collections to ‘ChangeSet#member_of_collection_ids`.
Instance Method Details
#call(change_set, collection_ids: []) ⇒ Dry::Monads::Result
Add to collections by inserting collections to ‘ChangeSet#member_of_collection_ids`.
28 29 30 31 32 33 34 |
# File 'lib/hyrax/transactions/steps/add_to_collections.rb', line 28 def call(change_set, collection_ids: []) = check_multi_membership(change_set, collection_ids) return Failure() if .present? change_set.member_of_collection_ids += collection_ids Success(change_set) end |