# Auto Complete

**URL:** <https://www.ruby-forum.com/t/auto-complete/160174>\
**Category:** Rails\
**Created:** [February 12, 2009, 3:38pm UTC](https://www.ruby-forum.com/t/auto-complete/160174 "2009-02-12T15:38:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![miguelrodriguez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@miguelrodriguez](https://www.ruby-forum.com/u/miguelrodriguez)\
**Post date:** [February 12, 2009, 3:38pm UTC](https://www.ruby-forum.com/t/auto-complete/160174/1 "2009-02-12T15:38:16Z")

</div>

What I’m trying to do:  
I want to create an auto completed field for locations, but didn’t  
want to have the locations stored in my app. My idea is to somehow use  
Google to fill that auto complete text field and then retrieve chords  
using gmaps geocoding. Have anyone done something like this? does  
Google was some api to do something like that? You think there is any  
chance of doing this, without storing a list of locations in my db??  
and which do you think is the best plugin for auto complete. Thanks in  
advanced every one

---

<div class="post-metadata">

**Author:** ![miguelrodriguez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@miguelrodriguez](https://www.ruby-forum.com/u/miguelrodriguez)\
**Post date:** [February 12, 2009, 4:49pm UTC](https://www.ruby-forum.com/t/auto-complete/160174/2 "2009-02-12T16:49:58Z")

</div>

Miguel R. wrote:

> What I’m trying to do:  
> I want to create an auto completed field for locations, but didn’t  
> want to have the locations stored in my app. My idea is to somehow use  
> Google to fill that auto complete text field and then retrieve chords  
> using gmaps geocoding. Have anyone done something like this? does  
> Google was some api to do something like that? You think there is any  
> chance of doing this, without storing a list of locations in my db??  
> and which do you think is the best plugin for auto complete. Thanks in  
> advanced every one

The Ajax.Autocompleter would definitely work for your auto-complete text  
field so that’s not an issue. What will be the challenge in your case  
will be the server-side action that builds the unordered list that will  
contain the locations.

[http://wiki.github.com/madrobby/scriptaculous/ajax-autocompleter](http://wiki.github.com/madrobby/scriptaculous/ajax-autocompleter)

All that’s expected from the server-side action is that it returns an  
unordered list. How you build that is up to you. What might be tricky in  
your case is getting decent performance.

What do you mean by locations? The Earth has effectively infinite  
locations. And even if you talking about “named” locations, in the sense  
they can be searched for in Google Maps, the number of them is extremely  
large. If you’re expecting that when the user type “A” every location  
from Google Maps that start with “A” gets returned in a list, I don’t  
think you’ll find that. I could be wrong, but I think that if it was  
that simple Google Maps would provide that sort of auto-completion.

---

<div class="post-metadata">

**Author:** ![miguelrodriguez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@miguelrodriguez](https://www.ruby-forum.com/u/miguelrodriguez)\
**Post date:** [February 12, 2009, 10:30pm UTC](https://www.ruby-forum.com/t/auto-complete/160174/3 "2009-02-12T22:30:06Z")

</div>

yes, I realised I’ll need to fill my data base with a bunch of  
locations. It seems wikipedia has a big list of UK locations and towns  
I’ll have to do a parser to somehow retrieve that information. About  
the plugin I would like to use jquery in my app, I found this plugin  
[GitHub - chris/auto\_complete\_jquery: Rails plugin for auto\_complete with jQuery instead of Prototype/Scriptaculous](http://github.com/chris/auto_complete_jquery/) but I noticed there is a  
few more, is there some default in the community, or any big  
differences between this and the one you suggested?
