Created
August 22, 2013 16:40
-
-
Save jakecraige/6309704 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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