From a4904c80a0f8856e82c1f83901f37ff432f7d036 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 17 May 2016 13:37:28 -0400 Subject: [PATCH] Update customer.rb --- app/models/customer.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/customer.rb b/app/models/customer.rb index ff2e5e9..494bbc4 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -109,9 +109,9 @@ class Customer < ActiveRecord::Base #query << " Where Metadata.LastUpdatedTime >= '#{last.iso8601}' " if last query << " Order By DisplayName " - customers = Qbo.get_base(:customer).service.query_in_batches(query, per_page: 100) do |batch| - batch.each do |customer| - without_callback(:save, :before, :save) do + without_callback(:save, :before, :save) do + customers = Qbo.get_base(:customer).service.query_in_batches(query, per_page: 100) do |batch| + batch.each do |customer| # Update the customer table qbo_customer = Customer.find_or_create_by(id: customer.id) qbo_customer.name = customer.display_name