Class: DatasetRecord::DarwinCore::Occurrence::ImportProtonym::CreateIfNotExists

Inherits:
DatasetRecord::DarwinCore::Occurrence::ImportProtonym show all
Defined in:
app/models/dataset_record/darwin_core/occurrence.rb

Instance Method Summary collapse

Methods inherited from DatasetRecord::DarwinCore::Occurrence::ImportProtonym

create_if_not_exists, #execute, match_existing

Instance Method Details

#exception_args(origins, parent, name, protonym) ⇒ Object



142
143
144
145
146
147
148
# File 'app/models/dataset_record/darwin_core/occurrence.rb', line 142

def exception_args(origins, parent, name, protonym)
  {
    origins[name.object_id] => name[:rank_class].present? ?
    protonym.errors.messages.values.flatten :
    ["Rank for #{name[:name]} could not be determined. Please create this taxon name manually and retry."]
  }
end

#get_protonym(parent, name) ⇒ Object



138
139
140
# File 'app/models/dataset_record/darwin_core/occurrence.rb', line 138

def get_protonym(parent, name)
  super || Protonym.create({parent:, also_create_otu: true}.merge!(name))
end