# Acts\_as\_ferret and ajax

**URL:** <https://www.ruby-forum.com/t/acts-as-ferret-and-ajax/125343>\
**Category:** Rails\
**Created:** [January 8, 2008, 1:09pm UTC](https://www.ruby-forum.com/t/acts-as-ferret-and-ajax/125343 "2008-01-08T13:09:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bartee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d78d45/32.png) [@bartee](https://www.ruby-forum.com/u/bartee)\
**Post date:** [January 8, 2008, 1:09pm UTC](https://www.ruby-forum.com/t/acts-as-ferret-and-ajax/125343/1 "2008-01-08T13:09:58Z")

</div>

I want to do a thing like Google does in the eMail name lookup, where I  
can type a few characters and then make ajax call and get back a list

TIA

---

<div class="post-metadata">

**Author:** ![bartee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d78d45/32.png) [@bartee](https://www.ruby-forum.com/u/bartee)\
**Post date:** [January 8, 2008, 9:13pm UTC](https://www.ruby-forum.com/t/acts-as-ferret-and-ajax/125343/2 "2008-01-08T21:13:32Z")

</div>

You want to use Ajax Autocomplete.  
Check out the raw usage at [http://wiki.script.aculo.us/](http://wiki.script.aculo.us/)  
Or  
[http://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptMacrosHelper.html#M000579](http://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptMacrosHelper.html#M000579)

In your model, make it acts\_as\_ferret with the appropriate fields.  
In your controller use find\_by\_contents to get the list of possible  
contacts using the search string

I can provide code examples if you want, but this should be enough to  
point you in the right direction anyway.

Luke

On Jan 9, 1:09 am, Bartee L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
