From 12166839b26ef6188065c82bba0cc30490d0bf54 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 17 May 2016 13:06:58 -0400 Subject: [PATCH] Update customer.rb --- app/models/customer.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/models/customer.rb b/app/models/customer.rb index c7e2e68..6d8961f 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -111,10 +111,12 @@ class Customer < ActiveRecord::Base 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.update_column(:name, customer.display_name) - qbo_customer.update_column(:id, customer.id) + without_callback(:save, :before, :save) do + # Update the customer table + qbo_customer = Customer.find_or_create_by(id: customer.id) + qbo_customer.name = customer.display_name + qbo_customer.id = customer.id + end end end