Skip to content

Instantly share code, notes, and snippets.

@slant
Created March 14, 2011 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slant/bb3b54f2ec793cf00fd0 to your computer and use it in GitHub Desktop.
Save slant/bb3b54f2ec793cf00fd0 to your computer and use it in GitHub Desktop.
def get_autocomplete_items(parameters)
items = Contact.select("DISTINCT CONCAT_WS(' ', first_name, last_name) AS full_name, first_name, last_name").where(["CONCAT_WS(' ', first_name, last_name) LIKE ?", "%#{parameters[:term]}%"])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment