# Auto Complete

**URL:** <https://discuss.rubyonrails.org/t/auto-complete/30868>\
**Category:** rubyonrails-talk\
**Created:** [June 20, 2008, 3:28pm UTC](https://discuss.rubyonrails.org/t/auto-complete/30868 "2008-06-20T15:28:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_McAuley](https://avatars.discourse-cdn.com/v4/letter/j/71e660/32.png) [@John\_McAuley](https://discuss.rubyonrails.org/u/John_McAuley)\
**Post date:** [June 20, 2008, 3:28pm UTC](https://discuss.rubyonrails.org/t/auto-complete/30868/1 "2008-06-20T15:28:52Z")

</div>

Hello All,

The rails auto complete, text\_field\_with\_auto\_complete, compares terms using the SQL function LIKE with wildcards on with side of the keyword. Although flashy, this is pretty much useless in the greater schemesof things. For instance, I have a table with 2500 rows and this approach returns the same twenty or so no matter what keywords the user enters. Has anyone implemented an autocompletye that searches for terms alphabetically?

Regards,

john

---

<div class="post-metadata">

**Author:** ![fxn](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/fxn/32/12956_2.png) [@fxn](https://discuss.rubyonrails.org/u/fxn)\
**Post date:** [June 20, 2008, 3:34pm UTC](https://discuss.rubyonrails.org/t/auto-complete/30868/2 "2008-06-20T15:34:29Z")

</div>

You can write your own autocomplete action named

&nbsp;&nbsp;&nbsp;auto\_complete\_for\_#{object}\_#{method}

Compute your custom completions and send back the result with

&nbsp;&nbsp;&nbsp;\<%= auto\_complete\_result @completions %\>

-- fxn
