Class: Specimen
- Inherits:
-
CollectionObject::BiologicalCollectionObject
- Object
- CollectionObject
- CollectionObject::BiologicalCollectionObject
- Specimen
- Defined in:
- app/models/specimen.rb
Overview
A Specimen is a single (by single we mean a curator has enumerated the object as 1), physical, and biological individual that has been collected.
Constant Summary
Constants included from Shared::IsDwcOccurrence
Shared::IsDwcOccurrence::DWC_DELIMITER, Shared::IsDwcOccurrence::VIEW_EXCLUSIONS
Instance Attribute Summary collapse
-
#total ⇒ 1
A specimen always has a total of one.
Instance Method Summary collapse
- #check_and_set_total ⇒ Object protected
Methods inherited from CollectionObject::BiologicalCollectionObject
#current_taxon_determination=, #reorder_determinations_by, #sv_determined_before_collected, #sv_fix_missing_determination, #sv_missing_biocuration_classification, #sv_missing_collecting_event, #sv_missing_determination, #sv_missing_preparation_type, #sv_missing_repository
Methods included from CollectionObject::DwcExtensions
#dwc_associated_media, #dwc_associated_taxa, #dwc_caste, #dwc_catalog_number, #dwc_collection_code, #dwc_event_time, #dwc_higher_classification, #dwc_individual_count, #dwc_institution_code, #dwc_institution_id, #dwc_internal_attribute_for, #dwc_life_stage, #dwc_occurrence_remarks, #dwc_occurrence_status, #dwc_other_catalog_numbers, #dwc_preparations, #dwc_record_number, #dwc_sex, #dwc_type_status, #dwc_verbatim_label, #is_fossil?
Methods included from Shared::IsDwcOccurrence
#dwc_occurrence_attribute_values, #dwc_occurrence_attributes, #dwc_occurrence_basis, #dwc_occurrence_id, #dwc_otu_id, #get_dwc_occurrence, #set_dwc_occurrence
Instance Attribute Details
#total ⇒ 1
Returns a specimen always has a total of one.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/specimen.rb', line 8 class Specimen < CollectionObject::BiologicalCollectionObject is_origin_for 'Specimen', 'Extract', 'AssertedDistribution', 'Sequence', 'Sound', 'AnatomicalPart' originates_from 'Specimen', 'Lot', 'RangedLot' if: -> {self.type == 'Specimen'} do |s| s.before_validation :check_and_set_total s.validates :total, inclusion: { in: 1..1 }, presence: true end protected def check_and_set_total if self.total.blank? self.total ||= 1 end end end |
Instance Method Details
#check_and_set_total ⇒ Object (protected)
20 21 22 23 24 |
# File 'app/models/specimen.rb', line 20 def check_and_set_total if self.total.blank? self.total ||= 1 end end |