Module: Shared::QueryBatchUpdate

Extended by:
ActiveSupport::Concern
Included in:
AssertedDistribution, BiologicalAssociation, CollectingEvent, CollectionObject, FieldOccurrence, Otu, Source::Bibtex, TaxonName
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



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

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