Class: Depiction

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Housekeeping, Shared::IsData, Shared::Taggable
Defined in:
app/models/depiction.rb

Overview

A depiction is the linkage between an image and a data object. For example an image may depiction a ColletingEvent, CollectionObject, or OTU.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods included from Housekeeping

#has_polymorphic_relationship?

Instance Attribute Details

- (Integer) depiction_object_id

Returns the id of the object being depicted

Returns:

  • (Integer)

    the id of the object being depicted



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/models/depiction.rb', line 20

class Depiction < ActiveRecord::Base
  # TODO: add position scoping

  include Housekeeping
  include Shared::Taggable
  include Shared::IsData

  acts_as_list scope: [:depiction_object_type, :depiction_object_id]

  belongs_to :image, inverse_of: :depictions
  belongs_to :depiction_object, polymorphic: true

  has_one :sqed_depiction, dependent: :destroy

  validates_presence_of :depiction_object

  accepts_nested_attributes_for :image
  accepts_nested_attributes_for :depiction_object

  # @return [DepictionObject]
  #   alias to simplify reference across classes 
  def annotated_object
    depiction_object
  end

end

- (String) depiction_object_type

Returns the type of object being depicted, a TW class that can be depicted (e.g. CollectionObject, CollectingEvent)

Returns:

  • (String)

    the type of object being depicted, a TW class that can be depicted (e.g. CollectionObject, CollectingEvent)



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/models/depiction.rb', line 20

class Depiction < ActiveRecord::Base
  # TODO: add position scoping

  include Housekeeping
  include Shared::Taggable
  include Shared::IsData

  acts_as_list scope: [:depiction_object_type, :depiction_object_id]

  belongs_to :image, inverse_of: :depictions
  belongs_to :depiction_object, polymorphic: true

  has_one :sqed_depiction, dependent: :destroy

  validates_presence_of :depiction_object

  accepts_nested_attributes_for :image
  accepts_nested_attributes_for :depiction_object

  # @return [DepictionObject]
  #   alias to simplify reference across classes 
  def annotated_object
    depiction_object
  end

end

- (Integer) image_id

Returns the id of the image that stores the depiction

Returns:

  • (Integer)

    the id of the image that stores the depiction



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/models/depiction.rb', line 20

class Depiction < ActiveRecord::Base
  # TODO: add position scoping

  include Housekeeping
  include Shared::Taggable
  include Shared::IsData

  acts_as_list scope: [:depiction_object_type, :depiction_object_id]

  belongs_to :image, inverse_of: :depictions
  belongs_to :depiction_object, polymorphic: true

  has_one :sqed_depiction, dependent: :destroy

  validates_presence_of :depiction_object

  accepts_nested_attributes_for :image
  accepts_nested_attributes_for :depiction_object

  # @return [DepictionObject]
  #   alias to simplify reference across classes 
  def annotated_object
    depiction_object
  end

end

- (Integer) project_id

Returns the project ID

Returns:

  • (Integer)

    the project ID



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/models/depiction.rb', line 20

class Depiction < ActiveRecord::Base
  # TODO: add position scoping

  include Housekeeping
  include Shared::Taggable
  include Shared::IsData

  acts_as_list scope: [:depiction_object_type, :depiction_object_id]

  belongs_to :image, inverse_of: :depictions
  belongs_to :depiction_object, polymorphic: true

  has_one :sqed_depiction, dependent: :destroy

  validates_presence_of :depiction_object

  accepts_nested_attributes_for :image
  accepts_nested_attributes_for :depiction_object

  # @return [DepictionObject]
  #   alias to simplify reference across classes 
  def annotated_object
    depiction_object
  end

end

Instance Method Details

- (DepictionObject) annotated_object

Returns alias to simplify reference across classes

Returns:

  • (DepictionObject)

    alias to simplify reference across classes



41
42
43
# File 'app/models/depiction.rb', line 41

def annotated_object
  depiction_object
end