views:

71

answers:

1

Hello,

My user model is using geokit to find the address from the ipaddress. How do I let the user select a different country, state or city? (select list) I have checked all the documentation and I can't figuere out how I retrieve a list of countries, states or cities.

Best regards Asbjørn Morell

A: 

Your question isn't 100% clear but you may be trying to do something Geokit isn't designed for.

Geokit basically does one thing: it takes an IP address, or a physical address, and gives you the lat/long. When you install it as a Rails plugin, you can geocode your models (usually with a street address) and it adds some useful stuff to your model classes. These extra things let you compute distances between your model objects.

AFAIK, you can't get a list of countries from Geokit. On my projects I've either used one of the free online lists, exported a list from another application, or subscribed to a service.

Sarah Mei
What free services are avalible for countries, states and cities lists?
atmorell
http://snipplr.com/view/4792/country-drop-down-list-for-web-forms/ is one. Generally I just scrape them into a text file and import via migration. Usually the client has a list they can provide though, either from their previous site or their payment processor.
Sarah Mei