Class: TaxonNameClassification::Latinized::PartOfSpeech

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

Defined Under Namespace

Classes: Adjective, NounInApposition, NounInGenitiveCase, Participle

Constant Summary collapse

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TaxonNameClassification::Latinized

assignable

Class Method Details

.applicable_ranksObject



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

def self.applicable_ranks
  SPECIES_RANK_NAMES
end

Instance Method Details

#set_gender_in_taxon_nameObject (protected)

A set_cached helper, see Participle, Adjective



12
13
14
15
16
17
18
19
20
21
22
# File 'app/models/taxon_name_classification/latinized/part_of_speech.rb', line 12

def set_gender_in_taxon_name
  t = taxon_name
  if t.masculine_name.blank? && t.feminine_name.blank? && t.neuter_name.blank?
    forms = Utilities::Nomenclature.predict_three_forms(t.name)
    t.update_columns(
      masculine_name: forms[:masculine_name],
      feminine_name: forms[:feminine_name],
      neuter_name: forms[:neuter_name]
    )
  end
end

#validate_uniqueness_of_latinizedObject (protected)



24
25
26
27
28
# File 'app/models/taxon_name_classification/latinized/part_of_speech.rb', line 24

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