Class: ObservationMatrixRow

Inherits:
ApplicationRecord show all
Includes:
Housekeeping, Shared::Citable, Shared::Identifiable, Shared::IsData, Shared::Notable, Shared::Taggable
Defined in:
app/models/observation_matrix_row.rb

Instance Method Summary (collapse)

Methods included from Housekeeping

#has_polymorphic_relationship?

Methods included from ActiverecordUtilities

#trim_attributes

Instance Method Details

- (Object) otu_and_collection_object_blank (private)



33
34
35
36
37
# File 'app/models/observation_matrix_row.rb', line 33

def otu_and_collection_object_blank
  if otu_id.nil? && collection_object_id.nil?
    errors.add(:base, "Specify otu OR collection object!")
  end
end

- (Object) otu_and_collection_object_given (private)



39
40
41
42
43
# File 'app/models/observation_matrix_row.rb', line 39

def otu_and_collection_object_given
  if !otu_id.nil? && !collection_object_id.nil?
    errors.add(:base, "Specify otu OR collection object, not both!")
  end
end

- (Object) row_object



27
28
29
# File 'app/models/observation_matrix_row.rb', line 27

def row_object
  [otu, collection_object].compact.first
end

- (Object) set_reference_count



23
24
25
# File 'app/models/observation_matrix_row.rb', line 23

def set_reference_count
  self.reference_count ||= 0
end