Update qbo_employee.rb

Fixed noob mistake
This commit is contained in:
2016-03-10 12:20:34 -05:00
parent 9acc33e373
commit 49f2baed9f

View File

@@ -19,16 +19,16 @@ class QboEmployee < ActiveRecord::Base
end end
def self.update_all def self.update_all
customers = get_base.service.all employees = get_base.service.all
# Update the item table # Update the item table
customers.each { |employee| employee.each { |employee|
qbo_employee = QboEmployee.find_or_create_by(id: employee.id) qbo_employees = QboEmployee.find_or_create_by(id: employee.id)
qbo_employee.name = employee.display_name qbo_employee.name = employee.display_name
qbo_employee.save! qbo_employee.save!
} }
#remove deleted employees #remove deleted employees
where.not(customers.map(&:id)).destroy_all where.not(employees.map(&:id)).destroy_all
end end
end end