Sha256: b3106aba0dcd1bab2b63ff5064329748c2f8b3cd79a4beb172ff22d9564eb2bd

Contents?: true

Size: 871 Bytes

Versions: 4

Compression:

Stored size: 871 Bytes

Contents

require Sufia::Engine.root.join('app/models/generic_file')
require File.expand_path("../curation_concern/with_access_right", __FILE__)
require File.expand_path("../curation_concern/embargoable", __FILE__)
require File.expand_path("../../repository_datastreams/file_content_datastream", __FILE__)

class GenericFile
  include CurationConcern::WithAccessRight
  include CurationConcern::Embargoable

  belongs_to :batch, property: :is_part_of, class_name: 'ActiveFedora::Base'

  validates :batch, presence: true
  validates :file, presence: true, on: :create

  attr_accessor :file, :version

  def filename
    content.label
  end

  def to_s
    title || label || "No Title"
  end

  def versions
    content.versions
  end

  def current_version_id
    content.latest_version.versionID
  end

  def human_readable_type
    self.class.to_s.demodulize.titleize
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
curate-0.1.3 app/repository_models/generic_file.rb
curate-0.1.2 app/repository_models/generic_file.rb
curate-0.1.1 app/repository_models/generic_file.rb
curate-0.1.0 app/repository_models/generic_file.rb