I have the zip code of the user that they entered and would like to pre-populate a few fields with the city/state. Does anyone know of a good way to get this information? I want to do something like this:
GeoIP.new('geoip/GeoLiteCity.dat').zip('53593')
I know I could do GeoIP.new('geoip/GeoLiteCity.dat').city(request.remote_ip)
but that's where they are at the time as opposed to where they may actually live.
I don't think the
geoip
Ruby gem (Github repo) has the ability to search by zip / postal code. When scanning the geoip.rb source, there is no method forzip
orpostal_code
.There is another gem,
my_zipcode_gem
, that you may be able to use. This is also hosted on Github and has the following syntax: