QueryValidationError: property 'PrimaryPhone' is not queryable

This commit is contained in:
2016-08-05 08:52:33 -04:00
committed by GitHub
parent b093f6136e
commit 15912b2197

View File

@@ -144,14 +144,14 @@ class Customer < ActiveRecord::Base
def self.search(search) def self.search(search)
customers = where("name LIKE ?", "%#{search}%") customers = where("name LIKE ?", "%#{search}%")
if customers.empty? #if customers.empty?
service = Qbo.get_base(:customer).service # service = Qbo.get_base(:customer).service
results = service.query("Select Id From Customer Where PrimaryPhone LIKE '%#{search}%' AND Mobile LIKE '%#{search}%'") # results = service.query("Select Id From Customer Where PrimaryPhone LIKE '%#{search}%' AND Mobile LIKE '%#{search}%'")
results.each do |customer| # results.each do |customer|
customers << Customer.find_by_id(customer.id) # customers << Customer.find_by_id(customer.id)
end # end
end #end
return customers.order(:name) return customers.order(:name)
end end