Module: Shared::QueryBatchUpdate

Extended by:
ActiveSupport::Concern
Included in:
AssertedDistribution, BiologicalAssociation, CollectingEvent, CollectionObject, Otu, Source::Bibtex
Defined in:
app/models/concerns/shared/query_batch_update.rb

Overview

Facilitate batch updates that use a BatchQueryRequest

Instance Method Summary collapse

Instance Method Details

#query_update(params, response) ⇒ Object

Called on Delayed::Job version



13
14
15
16
17
18
19
20
21
22
# File 'app/models/concerns/shared/query_batch_update.rb', line 13

def query_update(params, response)
  begin
    self.update!( params )
    response[:updated].push id
  rescue ActiveRecord::RecordInvalid => e
    response.not_updated.push e.record.id
    response.errors[e.message] += 1
  end
  result
end