Sha256: 1f05f03e3460b09302660fdc40f9a547fce836208a5fea32d949d7522cef3883

Contents?: true

Size: 570 Bytes

Versions: 14

Compression:

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

  def collection_uri
    self.collection.internal_uri rescue nil
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ddr-models-1.11.8 app/models/component.rb
ddr-models-1.11.7 app/models/component.rb
ddr-models-1.11.6 app/models/component.rb
ddr-models-1.11.5 app/models/component.rb
ddr-models-1.11.4 app/models/component.rb
ddr-models-1.11.3 app/models/component.rb
ddr-models-1.11.2 app/models/component.rb
ddr-models-1.11.1 app/models/component.rb
ddr-models-1.11.0 app/models/component.rb
ddr-models-1.10.0 app/models/component.rb
ddr-models-1.9.0 app/models/component.rb
ddr-models-1.8.1 app/models/component.rb
ddr-models-1.8.0 app/models/component.rb
ddr-models-1.7.0 app/models/component.rb