Class: BiologicalRelationshipType

Inherits:
ApplicationRecord show all
Includes:
Housekeeping, Shared::IsData
Defined in:
app/models/biological_relationship_type.rb

Overview

A biological relationship type a domain or range assertion for a biological Relationship.

Defined Under Namespace

Classes: BiologicalRelationshipObjectType, BiologicalRelationshipSubjectType

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Shared::IsData

#errors_excepting, #full_error_messages_excepting, #identical, #is_community?, #is_destroyable?, #is_editable?, #is_in_use?, #is_in_users_projects?, #metamorphosize, #similar

Methods included from Housekeeping

#has_polymorphic_relationship?

Methods inherited from ApplicationRecord

transaction_with_retry

Instance Attribute Details

#biological_property_idInteger

Returns the property to assign.

Returns:

  • (Integer)

    the property to assign



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/models/biological_relationship_type.rb', line 19

class BiologicalRelationshipType < ApplicationRecord
  include Housekeeping
  include Shared::IsData

  belongs_to :biological_property, inverse_of: :biological_relationship_types
  belongs_to :biological_relationship, inverse_of: :biological_relationship_types

  validates_presence_of :type
  validates :biological_property, presence: true
  validates :biological_relationship, presence: true

  def target
    (self.type =~ /Subject/) ? 'subject' : 'object'
  end

end

#biological_relationship_idInteger

Returns the relationship to assign it to.

Returns:

  • (Integer)

    the relationship to assign it to



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/models/biological_relationship_type.rb', line 19

class BiologicalRelationshipType < ApplicationRecord
  include Housekeeping
  include Shared::IsData

  belongs_to :biological_property, inverse_of: :biological_relationship_types
  belongs_to :biological_relationship, inverse_of: :biological_relationship_types

  validates_presence_of :type
  validates :biological_property, presence: true
  validates :biological_relationship, presence: true

  def target
    (self.type =~ /Subject/) ? 'subject' : 'object'
  end

end

#project_idInteger

the project ID

Returns:

  • (Integer)


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/models/biological_relationship_type.rb', line 19

class BiologicalRelationshipType < ApplicationRecord
  include Housekeeping
  include Shared::IsData

  belongs_to :biological_property, inverse_of: :biological_relationship_types
  belongs_to :biological_relationship, inverse_of: :biological_relationship_types

  validates_presence_of :type
  validates :biological_property, presence: true
  validates :biological_relationship, presence: true

  def target
    (self.type =~ /Subject/) ? 'subject' : 'object'
  end

end

#typeString

Returns Assigns to domain (subject), or range (object).

Returns:

  • (String)

    Assigns to domain (subject), or range (object)



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/models/biological_relationship_type.rb', line 19

class BiologicalRelationshipType < ApplicationRecord
  include Housekeeping
  include Shared::IsData

  belongs_to :biological_property, inverse_of: :biological_relationship_types
  belongs_to :biological_relationship, inverse_of: :biological_relationship_types

  validates_presence_of :type
  validates :biological_property, presence: true
  validates :biological_relationship, presence: true

  def target
    (self.type =~ /Subject/) ? 'subject' : 'object'
  end

end

Instance Method Details

#targetObject



30
31
32
# File 'app/models/biological_relationship_type.rb', line 30

def target
  (self.type =~ /Subject/) ? 'subject' : 'object'
end