Class: Hyrax::Actors::AttachFilesActor

Inherits:
AbstractActor show all
Defined in:
app/actors/hyrax/actors/attach_files_actor.rb

Instance Attribute Summary

Attributes inherited from AbstractActor

#next_actor

Instance Method Summary collapse

Methods inherited from AbstractActor

#initialize

Constructor Details

This class inherits a constructor from Hyrax::Actors::AbstractActor

Instance Method Details

#create(attributes) ⇒ Object



4
5
6
7
8
9
# File 'app/actors/hyrax/actors/attach_files_actor.rb', line 4

def create(attributes)
  files = [attributes.delete(:files)].flatten.compact
  file_sets = attach_files(files, visibility_attributes(attributes))
  file_sets.all? { |fs| fs.is_a? ::FileSet } &&
    next_actor.create(attributes) && send_create_notifications(file_sets)
end

#update(attributes) ⇒ Object



11
12
13
14
15
# File 'app/actors/hyrax/actors/attach_files_actor.rb', line 11

def update(attributes)
  files = [attributes.delete(:files)].flatten.compact
  next_actor.update(attributes) &&
    attach_files(files, visibility_attributes(attributes))
end