Sha256: e784e6b53963a8d556b2f6dda320538d4648e283a0a29b9806a20deeca65e9e5

Contents?: true

Size: 486 Bytes

Versions: 6

Compression:

Stored size: 486 Bytes

Contents

module IiifPrint
  class IngestFileRelation < ApplicationRecord
    validates :file_path, presence: true
    validates :derivative_path, presence: true

    # Query by file path for all derivatives, as de-duplicated array of
    #   derivative paths.
    # @param path [String] Path to primary file
    # @return [Array<String>] de-duplicated array of derivative paths.
    def self.derivatives_for_file(path)
      where(file_path: path).pluck(:derivative_path).uniq
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
iiif_print-3.0.1 app/models/iiif_print/ingest_file_relation.rb
iiif_print-3.0.0 app/models/iiif_print/ingest_file_relation.rb
iiif_print-2.0.1 app/models/iiif_print/ingest_file_relation.rb
iiif_print-2.0.0 app/models/iiif_print/ingest_file_relation.rb
iiif_print-1.1.0 app/models/iiif_print/ingest_file_relation.rb
iiif_print-1.0.0 app/models/iiif_print/ingest_file_relation.rb