Sha256: 70038393f2435e7be95cd8d26b7ee89d7cf8d4b9f20a71c8d5bb54c62fba74e2

Contents?: true

Size: 766 Bytes

Versions: 7

Compression:

Stored size: 766 Bytes

Contents

#
# A Component is a part of an Item; the principal content-bearing repository resource.
#
# Examples: Page of a book, track of a recording, etc.
#
class Component < Ddr::Models::Base

  include Ddr::Models::HasContent
  include Ddr::Models::HasMultiresImage
  include Ddr::Models::HasStructMetadata

  belongs_to :parent,
             predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf,
             class_name: "Item"

  belongs_to :target,
             predicate: ::RDF::URI("http://www.loc.gov/mix/v20/externalTarget#hasExternalTarget"),
             class_name: "Target"

  def collection
    self.parent.parent rescue nil
  end

  def collection_id
    collection.id rescue nil
  end

  def publishable?
    parent.present? && parent.published?
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ddr-models-3.0.0.beta.17 app/models/component.rb
ddr-models-3.0.0.beta.16 app/models/component.rb
ddr-models-3.0.0.beta.15 app/models/component.rb
ddr-models-3.0.0.beta.14 app/models/component.rb
ddr-models-3.0.0.beta.13 app/models/component.rb
ddr-models-3.0.0.beta.12 app/models/component.rb
ddr-models-3.0.0.beta.11 app/models/component.rb