mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 08:54:23 -05:00
Update customers_controller.rb
This commit is contained in:
@@ -32,18 +32,7 @@ class CustomersController < ApplicationController
|
|||||||
|
|
||||||
default_search_scope :names
|
default_search_scope :names
|
||||||
|
|
||||||
def auto_complete
|
autocomplete :customer, :name
|
||||||
@customers = []
|
|
||||||
q = (params[:q] || params[:term]).to_s.strip
|
|
||||||
if q.present?
|
|
||||||
if q.match(/\A#?(\d+)\z/)
|
|
||||||
@customers << Customer.find_by_id($1.to_i)
|
|
||||||
end
|
|
||||||
@customers += Customer.where("LOWER(#{Customer.table_name}.name) LIKE LOWER(?)", "%#{q}%").order("#{Customer.table_name}.id DESC").limit(10).to_a
|
|
||||||
@customers.compact!
|
|
||||||
end
|
|
||||||
render :layout => false
|
|
||||||
end
|
|
||||||
|
|
||||||
# display a list of all customers
|
# display a list of all customers
|
||||||
def index
|
def index
|
||||||
|
|||||||
Reference in New Issue
Block a user