lib/dwc-archive/classification_normalizer.rb in dwc-archive-0.4.5 vs lib/dwc-archive/classification_normalizer.rb in dwc-archive-0.4.6

- old
+ new

@@ -5,11 +5,14 @@ class TaxonNormalized attr_accessor :id, :parent_id, :classification_path, :current_name, :current_name_canonical, :synonyms, :vernacular_names, :rank, :status def initialize - @id = @parent_id = @classification_path = @current_name = @current_name_canonical = @rank = @status = nil + @id = @parent_id = @rank = @status = nil + @current_name = '' + @current_name_canonical = '' + @classification_path = [] @synonyms = [] @vernacular_names = [] end end @@ -114,10 +117,10 @@ end def get_classification_path(taxon) return if taxon.classification_path if DarwinCore.nil_field?(taxon.parent_id) - taxon.classification_path = [taxon.current_name_canonical] + taxon.classification_path << taxon.current_name_canonical else begin parent_cp = @res[taxon.parent_id].classification_path rescue NoMethodError #name has a parent which is not a current name error = "The parent of the taxon \'#{taxon.current_name}\' is deprecated"