Module: Sufia::GenericFile::Batches
- Extended by:
- ActiveSupport::Concern
- Included in:
- Sufia::GenericFile
- Defined in:
- app/models/concerns/sufia/generic_file/batches.rb
Instance Method Summary collapse
-
#processing? ⇒ Boolean
Is this file in the middle of being processed by a batch?.
-
#related_files ⇒ Object
Get the files with a sibling relationship (belongs_to :batch) The batch id is minted when visiting the upload screen and attached to each file when it is done uploading.
Instance Method Details
#processing? ⇒ Boolean
Is this file in the middle of being processed by a batch?
21 22 23 |
# File 'app/models/concerns/sufia/generic_file/batches.rb', line 21 def processing? try(:batch).try(:status) == ['processing'.freeze] end |
#related_files ⇒ Object
Get the files with a sibling relationship (belongs_to :batch) The batch id is minted when visiting the upload screen and attached to each file when it is done uploading. The Batch object is not created until all objects are done uploading and the user is redirected to BatchController#edit. Therefore, we must handle the case where batch_id is set but batch returns nil.
15 16 17 18 |
# File 'app/models/concerns/sufia/generic_file/batches.rb', line 15 def return [] unless batch batch.generic_files.reject { |sibling| sibling.id == id } end |