Sha256: 365ffcaa7909c500ae71f361b3a7b2fae1e417ca3b7588a68b90dccfdde60f66

Contents?: true

Size: 651 Bytes

Versions: 3

Compression:

Stored size: 651 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, :property => :is_part_of, :class_name => 'Item'
  belongs_to :target, :property => :has_external_target, :class_name => 'Target'

  alias_method :item, :parent
  alias_method :item=, :parent=

  def collection
    self.parent.parent rescue nil
  end

  def collection_uri
    self.collection.internal_uri rescue nil
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ddr-models-1.13.2 app/models/component.rb
ddr-models-1.13.1 app/models/component.rb
ddr-models-1.13.0 app/models/component.rb