Geo_yahoo is a project mainly written in ..., based on the MIT license.
GeoYahoo is a simple Rails plugin that integrates Yahoo Geo api with your Rails Application, using jQuery autocomplete.
GeoYahoo is a simple Rails plugin that integrates Yahoo Geo api (http://developer.yahoo.com/geo/geoplanet/) with your Rails Application, using jQuery autocomplete. You can easily add an autocomplete Hometown field to your models, forgiving annoying Country and City tables in your app.
Go to your application dir and type
script/plugin install http://github.com/wadomo/GeoYahoo.git
Add this line before the last "end" of your config/environment.rb file:
ENV['YAHOO_API'] = "yourapikeyhere" (get it here http://developer.yahoo.com/geo/geoplanet/)
IMPORTANT!
You must include in your layout ( if you don't have yet):
<%= javascript_include_tag :defaults %>
That's it! Now you can add an autocomplete city field in your views!
Add this to your view.
<%= text_field_tag :city_autocomplete,"" %> <%= hidden_field_tag :country %> <%= hidden_field_tag :state %> <%= hidden_field_tag :city %> <%= geo_autocomplete "city_autocomplete",[:city,:country,:state] %>
It will update the hidden fields with the results of yahoo api request. You can customize the way that the results are shown adding a geo_yahoo/cities.html.erb file in your app/views folder.
============================================================================= Copyright (c) 2010 WaDoMo, released under the MIT license