Bind typehead to contact too

This commit is contained in:
Martin Lensment 2014-09-09 13:36:28 +03:00
parent 13349a6bc9
commit 1c165cd1e4
7 changed files with 55 additions and 30 deletions

View file

@ -1,7 +1,5 @@
class Admin::ContactsController < ApplicationController
def search
c = Contact.arel_table
query_string = "%#{params[:query]}%"
render json: Contact.where(c[:code].matches(query_string)).pluck(:code)
render json: Contact.search_by_query(params[:q])
end
end