Sha256: 45eceed0773a8260267847012aedbbb23bf8e5b18346be3b2cb0e6365190a40c

Contents?: true

Size: 491 Bytes

Versions: 3

Compression:

Stored size: 491 Bytes

Contents

module NewspaperWorks
  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

3 entries across 3 versions & 1 rubygems

Version Path
newspaper_works-1.0.1 app/models/newspaper_works/ingest_file_relation.rb
newspaper_works-1.0.0 app/models/newspaper_works/ingest_file_relation.rb
newspaper_works-0.1.0 app/models/newspaper_works/ingest_file_relation.rb