Class: ObservationMatrixRowItem::Single

Inherits:
ObservationMatrixRowItem show all
Defined in:
app/models/observation_matrix_row_item/single.rb

Constant Summary

Constants included from SoftValidation

SoftValidation::ANCESTORS_WITH_SOFT_VALIDATIONS

Instance Attribute Summary

Attributes inherited from ObservationMatrixRowItem

#observation_matrix_id, #observation_object_id, #observation_object_type, #position

Instance Method Summary collapse

Methods inherited from ObservationMatrixRowItem

batch_create, batch_create_from_pinboard, batch_create_from_tags, #cleanup_matrix_rows, #cleanup_single_matrix_row, create_for_pinboard_items, create_for_tags, #decrement_matrix_row_reference_count, #find_or_build_row, human_name, #increment_matrix_row_reference_count, #object_is?, subclass_attributes, #update_matrix_rows, #update_single_matrix_row

Methods included from SoftValidation

#clear_soft_validations, #fix_for, #fix_soft_validations, #soft_fixed?, #soft_valid?, #soft_validate, #soft_validated?, #soft_validations, #soft_validators

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 Shared::Notes

#concatenated_notes_string, #reject_notes

Methods included from Shared::Tags

#reject_tags, #tag_with, #tagged?, #tagged_with?

Methods included from Shared::Identifiers

#dwc_occurrence_id, #identified?, #next_by_identifier, #previous_by_identifier, #reject_identifiers, #uri, #uuid

Methods included from Shared::Citations

#cited?, #mark_citations_for_destruction, #nomenclature_date, #origin_citation_source_id, #reject_citations, #requires_citation?, #sources_by_topic_id

Methods included from Housekeeping

#has_polymorphic_relationship?

Methods inherited from ApplicationRecord

transaction_with_retry

Instance Method Details

#is_dynamic?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'app/models/observation_matrix_row_item/single.rb', line 5

def is_dynamic?
  false
end

#matrix_row_item_objectObject



9
10
11
# File 'app/models/observation_matrix_row_item/single.rb', line 9

def matrix_row_item_object
  observation_object
end

#observation_object_is_unique_in_matrixObject (private)



19
20
21
22
23
24
25
# File 'app/models/observation_matrix_row_item/single.rb', line 19

def observation_object_is_unique_in_matrix
  if ObservationMatrixRowItem::Single.where(
      observation_matrix_id: observation_matrix_id,
      observation_object: observation_object).where.not(id: id).any?
    errors.add(:observation_object, 'already exists in a row item in this matrix')
  end
end

#observation_objectsObject



13
14
15
# File 'app/models/observation_matrix_row_item/single.rb', line 13

def observation_objects
  [ observation_object ]
end