Skip to content

Instantly share code, notes, and snippets.

@jakecraige
Created August 22, 2013 16:40
Show Gist options
  • Save jakecraige/6309704 to your computer and use it in GitHub Desktop.
Save jakecraige/6309704 to your computer and use it in GitHub Desktop.
def autocomplete
render :json => autocomplete_for_column(params[:column_name])
end
def autocomplete_for_column(column_name)
#zipcode and mls num doesnt work
valid_names = %w(agentlist_fullname officelist_officename officesell_officename schooldistrict)
if valid_names.include? column_name
Property.select(column_name).where("#{column_name} LIKE ?", "%#{params[:q]}%").uniq
else
"Error! Column Name Not Allowed!"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment