Class: Hyrax::Actors::CreateWithFilesActor
- Inherits:
-
AbstractActor
- Object
- AbstractActor
- Hyrax::Actors::CreateWithFilesActor
- Defined in:
- app/actors/hyrax/actors/create_with_files_actor.rb
Overview
Creates a work and attaches files to the work
Instance Attribute Summary
Attributes inherited from AbstractActor
Instance Method Summary collapse
-
#create(env) ⇒ Boolean
True if create 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.
7 8 9 10 11 |
# File 'app/actors/hyrax/actors/create_with_files_actor.rb', line 7 def create(env) uploaded_file_ids = filter_file_ids(env.attributes.delete(:uploaded_files)) files = uploaded_files(uploaded_file_ids) validate_files(files, env) && next_actor.create(env) && attach_files(files, env) end |
#update(env) ⇒ Boolean
Returns true if update was successful.
15 16 17 18 19 |
# File 'app/actors/hyrax/actors/create_with_files_actor.rb', line 15 def update(env) uploaded_file_ids = filter_file_ids(env.attributes.delete(:uploaded_files)) files = uploaded_files(uploaded_file_ids) validate_files(files, env) && next_actor.update(env) && attach_files(files, env) end |