Sha256: 76a39c885ccb522fd9c0bf7c36ee1c2dc1edd0e80a862c13b1fb9194c6c26c5b

Contents?: true

Size: 699 Bytes

Versions: 13

Compression:

Stored size: 699 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

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ddr-models-3.0.0.beta.10 app/models/component.rb
ddr-models-3.0.0.beta.9 app/models/component.rb
ddr-models-3.0.0.beta.8 app/models/component.rb
ddr-models-3.0.0.beta.7 app/models/component.rb
ddr-models-3.0.0.beta.6 app/models/component.rb
ddr-models-3.0.0.beta.4 app/models/component.rb
ddr-models-3.0.0.beta.3 app/models/component.rb
ddr-models-3.0.0.beta.2 app/models/component.rb
ddr-models-3.0.0.beta.1 app/models/component.rb
ddr-models-3.0.0.alpha.4 app/models/component.rb
ddr-models-3.0.0.alpha.3 app/models/component.rb
ddr-models-3.0.0.alpha.2 app/models/component.rb
ddr-models-3.0.0.alpha.1 app/models/component.rb