Sha256: 0672b04158cb1a9988ae7321fb9ef922afbb9776af896d8caffe9178acf90cd0

Contents?: true

Size: 498 Bytes

Versions: 4

Compression:

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

  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

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ddr-models-1.6.0 app/models/component.rb
ddr-models-1.5.0 app/models/component.rb
ddr-models-1.4.0 app/models/component.rb
ddr-models-1.3.0 app/models/component.rb