Class: Hyrax::Actors::BaseActor
- Inherits:
-
AbstractActor
- Object
- AbstractActor
- Hyrax::Actors::BaseActor
- Defined in:
- app/actors/hyrax/actors/base_actor.rb
Overview
Defines the basic save/destroy and callback behavior, intended to run near the bottom of the actor stack.
Instance Attribute Summary
Attributes inherited from AbstractActor
Instance Method Summary collapse
-
#create(env) ⇒ Boolean
True if create was successful.
-
#destroy(env) ⇒ Boolean
True if destroy was successful.
-
#update(env) ⇒ Boolean
True if update was successful.
Methods inherited from AbstractActor
Constructor Details
This class inherits a constructor from Hyrax::Actors::AbstractActor
Instance Method Details
#create(env) ⇒ Boolean
Returns true if create was successful.
19 20 21 22 23 24 25 26 |
# File 'app/actors/hyrax/actors/base_actor.rb', line 19 def create(env) apply_creation_data_to_curation_concern(env) apply_save_data_to_curation_concern(env) save(env, use_valkyrie: Hyrax.config.use_valkyrie?) && next_actor.create(env) && run_callbacks(:after_create_concern, env) end |
#destroy(env) ⇒ Boolean
Returns true if destroy was successful.
38 39 40 41 42 43 44 45 |
# File 'app/actors/hyrax/actors/base_actor.rb', line 38 def destroy(env) env.curation_concern.in_collection_ids.each do |id| destination_collection = Hyrax.config.collection_class.find(id) destination_collection.members.delete(env.curation_concern) destination_collection.update_index end env.curation_concern.destroy end |
#update(env) ⇒ Boolean
Returns true if update was successful.
30 31 32 33 34 |
# File 'app/actors/hyrax/actors/base_actor.rb', line 30 def update(env) apply_update_data_to_curation_concern(env) apply_save_data_to_curation_concern(env) next_actor.update(env) && save(env) && run_callbacks(:after_update_metadata, env) end |