SDK
SDK

Reputation: 11

Google suggest and auto complete with jquery/ajax in Rails app

I would like to get some ref to use Jquery in Rails app. At the moment, I am stuck to find the things to enable google suggest in text box and autocomplete in Rails app. Any help/suggestions/ref would be of great help.

Upvotes: 1

Views: 1624

Answers (1)

Markus Proske
Markus Proske

Reputation: 3366

I did a short search on auto-complete with Rails earlier today and these are the best links I found:

Edit: I just implemented the first link in my app, works flawless so far. I had minor problems with the documentation though, this works for me (on typing AutoComplete starts after the second character):

Model named Category, has an attribute name:

controller:

class UsersController < ApplicationController
  autocomplete :category, :name
  ...

routes:

get 'users/autocomplete_category_name'

view:

<%= form_tag 'users/index' do %>
  <%= autocomplete_field_tag 'address', '', users_autocomplete_category_name_path, :size => 75 %>
<% end %>

Upvotes: 3

Related Questions