alexreisner/geocoder — Issue #164: Some cities won't geocode in the model
Author: elfassy
Created: 2012-01-22 21:24:08+00:00
State: open

If i do `Geocoder.search("Tunis,Tunisia")` in the console, it works as expected.

But if I used my model to geocode the address(:name) `"Tunis,Tunisia"` it just returns nil for every value. This is strange especially since other cities do work. Anything i'm missing (i tried both yahoo and google and both have the same results). Thanks.

geocoded_by :name do |obj,results|
if geo = results.first
obj.c_latitude = geo.latitude
obj.c_longitude = geo.longitude
obj.c_state = geo.state
obj.c_country = geo.country
obj.c_city = geo.city
end
end
after_validation :geocode, :if => :name_changed?