Skip to content

Instantly share code, notes, and snippets.

@robbyrussell
Forked from anonymous/gist:38352
Created December 20, 2008 16:13
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 robbyrussell/38353 to your computer and use it in GitHub Desktop.
Save robbyrussell/38353 to your computer and use it in GitHub Desktop.
def auto_complete_for_search_query
if params.has_key( :search_query ) and not params[:search_query].blank?
search_query = "%#{params[:search_query]}%"
@cars = Car.find( :all, :conditions => [ 'title LIKE ?', search_query ] )
render :partial => "search_results"
end
end
def search_query
auto_complete_for_search_query
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment