Class: NomenclaturalRank::Icn::HigherClassificationGroup

Inherits:
NomenclaturalRank::Icn show all
Defined in:
app/models/nomenclatural_rank/icn/higher_classification_group.rb

Defined Under Namespace

Classes: ClassRank, Kingdom, Order, Phylum, Subclass, Subkingdom, Suborder, Subphylum

Constant Summary

Constants inherited from NomenclaturalRank::Icn

KINGDOM

Class Method Summary collapse

Methods inherited from NomenclaturalRank::Icn

group_base

Methods inherited from NomenclaturalRank

abbreviation, bottom_rank, collect_descendants_to_s, collect_to_s, nomenclatural_code, nomenclatural_code_class, ordered_ranks, parent, parent_rank, rank_name, top_rank, typical_use, valid_name_ending

Class Method Details

.valid_parentsObject



12
13
14
15
# File 'app/models/nomenclatural_rank/icn/higher_classification_group.rb', line 12

def self.valid_parents
  self.collect_descendants_to_s(
    NomenclaturalRank::Icn::HigherClassificationGroup)
end

.validate_name_format(taxon_name) ⇒ Object



3
4
5
6
7
8
9
10
# File 'app/models/nomenclatural_rank/icn/higher_classification_group.rb', line 3

def self.validate_name_format(taxon_name)
  if !taxon_name.name.blank?
    taxon_name.errors.add(:name, 'must be capitalized') unless taxon_name.name == taxon_name.name.capitalize

    # TODO: this should be inherited/applied higher up?
    taxon_name.errors.add(:name, 'must be at least two letters') unless taxon_name.name.length > 1
  end
end