Method: Hyrax::Actors::FileSetActor#create_content
- Defined in:
- app/actors/hyrax/actors/file_set_actor.rb
#create_content(file, relation = :original_file, from_url: false) ⇒ IngestJob, FalseClass
Spawns asynchronous IngestJob unless ingesting from URL Called from FileSetsController, AttachFilesToWorkJob, IngestLocalFileJob, ImportUrlJob
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/actors/hyrax/actors/file_set_actor.rb', line 21 def create_content(file, relation = :original_file, from_url: false) # If the file set doesn't have a title or label assigned, set a default. file_set.label ||= label_for(file) file_set.title = [file_set.label] if file_set.title.blank? @file_set = perform_save(file_set) return false unless file_set if from_url # If ingesting from URL, don't spawn an IngestJob; instead # reach into the FileActor and run the ingest with the file instance in # hand. Do this because we don't have the underlying UploadedFile instance file_actor = build_file_actor(relation) file_actor.ingest_file(wrapper!(file: file, relation: relation)) parent = parent_for(file_set: file_set) VisibilityCopyJob.perform_later(parent) InheritPermissionsJob.perform_later(parent) else IngestJob.perform_later(wrapper!(file: file, relation: relation)) end end |