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



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

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



136
137
138
# File 'app/models/dataset_record/darwin_core/occurrence.rb', line 136

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