Class: Hybrid

Inherits:
TaxonName
  • Object
show all
Defined in:
app/models/hybrid.rb

Overview

A hybrid taxon, defined by adding relationships to this anonymous node.

If only one name is asserted to be a hybrid (i.e. without reference to multiple names) then this can be indicated by creating a Protonym and applying the status of Hybrid.

Instance Method Summary (collapse)

Instance Method Details

- (Object) get_full_name



26
27
28
29
# File 'app/models/hybrid.rb', line 26

def get_full_name
  hr = hybrid_relationships.reload
  hr.empty? ? '[HYBRID TAXA NOT SELECTED]' : hr.collect{|i| i.subject_taxon_name.cached}.sort.join(' x ')
end

- (Object) get_full_name_html(name = nil)

TODO: get rid of bogus params signature call



21
22
23
24
# File 'app/models/hybrid.rb', line 21

def get_full_name_html(name = nil)
  hr = hybrid_relationships.reload
  hr.empty? ? '[HYBRID TAXA NOT SELECTED]' : hr.collect{|i| i.subject_taxon_name.cached_html}.sort.join(' × ')
end

- (Object) set_cached_valid_taxon_name_id

Overridden here, not applicable to this class



32
33
34
# File 'app/models/hybrid.rb', line 32

def set_cached_valid_taxon_name_id
  true 
end

- (Object) sv_hybrid_name_relationships (protected)



42
43
44
45
46
47
48
49
# File 'app/models/hybrid.rb', line 42

def sv_hybrid_name_relationships
  case hybrid_relationships.count
  when 0
    soft_validations.add(:base, 'Hybrid is not linked to non hybrid taxa')
  when 1
    soft_validations.add(:base, 'Hybrid should be linked to at least two non hybrid taxa')
  end
end

- (Object) validate_rank_class_class (protected)



38
39
40
# File 'app/models/hybrid.rb', line 38

def validate_rank_class_class
  errors.add(:rank_class, 'It is not an ICN rank') unless ICN.include?(rank_string)
end