Update customer.rb

This commit is contained in:
2016-05-17 13:37:28 -04:00
parent 181b928d19
commit a4904c80a0

View File

@@ -109,9 +109,9 @@ class Customer < ActiveRecord::Base
#query << " Where Metadata.LastUpdatedTime >= '#{last.iso8601}' " if last #query << " Where Metadata.LastUpdatedTime >= '#{last.iso8601}' " if last
query << " Order By DisplayName " query << " Order By DisplayName "
customers = Qbo.get_base(:customer).service.query_in_batches(query, per_page: 100) do |batch| without_callback(:save, :before, :save) do
batch.each do |customer| customers = Qbo.get_base(:customer).service.query_in_batches(query, per_page: 100) do |batch|
without_callback(:save, :before, :save) do batch.each do |customer|
# Update the customer table # Update the customer table
qbo_customer = Customer.find_or_create_by(id: customer.id) qbo_customer = Customer.find_or_create_by(id: customer.id)
qbo_customer.name = customer.display_name qbo_customer.name = customer.display_name