To get a new seeds.rb file, just run parse_countries.php. This will build a seeds file to populate countries and states tables with all countries in the world along with all of their admin 1 regions. These regions correspond to what would be a state within the US. The generated file should be in utf8. The database model is pretty straightforward: countries: id name iso #An ISO abbreviation for the country states: id name country_id #the parent country's id, references an entry in countries. iso #An ISO abbreviation for the region. A special thanks to geonames.org for making all of this information available. You can find updated copies of the data files at: http://download.geonames.org/export/dump/
rkhater/Rails-Seed-All-Countries-and-All-States
A script to generate a seed file from a database of all countries and all of their states or regions for use inside a Rails application.
Ruby