Sha256: 72360d944de9935b7c2c21570c5312842c1d10b301653bff643866016801deb9
Contents?: true
Size: 927 Bytes
Versions: 6
Compression:
Stored size: 927 Bytes
Contents
module Sufia module GenericFile module Batches extend ActiveSupport::Concern included do belongs_to :batch, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf end # 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. def related_files return [] unless batch batch.generic_files.reject { |sibling| sibling.id == id } end # Is this file in the middle of being processed by a batch? def processing? try(:batch).try(:status) == ['processing'.freeze] end end end end
Version data entries
6 entries across 6 versions & 1 rubygems