Class: TaxonNameClassification::Latinized::Gender

Inherits:
TaxonNameClassification::Latinized show all
Defined in:
app/models/taxon_name_classification/latinized/gender.rb

Direct Known Subclasses

Feminine, Masculine, Neuter

Defined Under Namespace

Classes: Feminine, Masculine, Neuter

Constant Summary collapse

NOMEN_URI =
'http://purl.obolibrary.org/obo/NOMEN_0000045'.freeze

Constants included from SoftValidation

SoftValidation::ANCESTORS_WITH_SOFT_VALIDATIONS

Instance Attribute Summary

Attributes inherited from TaxonNameClassification

#project_id, #taxon_name_id, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TaxonNameClassification::Latinized

assignable

Methods inherited from TaxonNameClassification

#annotated_object, annotates?, assignable, #classification_label, code_applicability_end_year, code_applicability_start_year, collect_descendants_and_itself_to_s, collect_descendants_to_s, collect_to_s, disjoint_taxon_name_classes, gbif_status, label, #nomen_id, nomen_uri, #nomenclature_code, #nomenclature_code_matches, parent, possible_genus_endings, possible_species_endings, questionable_species_endings, #set_cached, #sv_fix_proper_classification, #sv_not_specific_classes, #sv_proper_classification, #sv_proper_year, #sv_validate_disjoint_classes, #type_class, #type_class=, #type_name, #validate_taxon_name_classification

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

Class Method Details

.applicable_ranksObject



5
6
7
# File 'app/models/taxon_name_classification/latinized/gender.rb', line 5

def self.applicable_ranks
  GENUS_RANK_NAMES
end

Instance Method Details

#set_cached_names_for_taxon_namesObject (private)



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/models/taxon_name_classification/latinized/gender.rb', line 17

def set_cached_names_for_taxon_names
  t = taxon_name
  t.update_columns(cached_gender: classification_label.downcase)

  t.descendants.unscope(:order).with_same_cached_valid_id.each do |t1|
    n = t1.get_full_name
    t1.update_columns(
      cached: n,
      cached_html: t1.get_full_name_html(n),
    )
  end

  TaxonNameRelationship::OriginalCombination.where(subject_taxon_name: t).collect{|i| i.object_taxon_name}.uniq.each do |t1|
    t1.update_cached_original_combinations
  end

  TaxonNameRelationship::Combination.where(subject_taxon_name: t).collect{|i| i.object_taxon_name}.uniq.each do |t1|
    t1.update_column(:verbatim_name, t1.cached) if t1.verbatim_name.nil?
    n = t1.get_full_name
    t1.update_columns(
      cached: n,
      cached_html: t1.get_full_name_html(n)
    )
  end
end

#validate_uniqueness_of_latinizedObject



9
10
11
12
13
# File 'app/models/taxon_name_classification/latinized/gender.rb', line 9

def validate_uniqueness_of_latinized
  if TaxonNameClassification::Latinized::Gender.where(taxon_name_id: self.taxon_name_id).not_self(self).any?
    errors.add(:taxon_name_id, 'The Gender is already selected')
  end
end