Class: DwcaCreateIndexJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- DwcaCreateIndexJob
- Defined in:
- app/jobs/dwca_create_index_job.rb
Instance Method Summary collapse
Instance Method Details
#perform(klass, sql_scope: nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/jobs/dwca_create_index_job.rb', line 8 def perform(klass, sql_scope: nil) errors = {} s = klass.safe_constantize.from('(' + sql_scope + ') as ' + klass.tableize) s.find_each do |o| begin o.set_dwc_occurrence rescue RGeo::Error::InvalidGeometry => e puts Rainbow("Error [#{o.id}] bad geometry not written. #{e}").red.bold errors[o.to_global_id.to_s] = e end end errors end |