This article is similar to
Proto!TextboxList + Autocomplete
The main source for this article is from
Get the original source Prototype UIAutoComplete
In ur rails application include the two js files & stylesheets(auto_complete & mac_os_x)
After creating ur rails project,try to create a scaffold named user
ruby script/generate scaffold user name:string
now you want to show the names to be displayed in the textbox using prototype autocomplete.While creating the rails application itself you will be having the prototype script.but check the versions.now include the js prototype-ui & the stylesheets.
Create a controller named list
ruby script/generate controller list
now in ur list controller
We have to use json since to convert a Ruby object into a JSON string.
In the controller file i have selected id as value & name as text,since in this format only we want to retrieve the datas.
Format given in the source file
Now a create a index.html.erb file.
Now in your layout at the head portion just include the js files and stylesheets
Now you have integrated ur rails application with Prototype UI autocomplete.
Autocomplete works by caching all the results from a JSON Request and feeding them to the autocompleter object.