Skip to content

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.

Notifications You must be signed in to change notification settings

Rubioli/Rails-Seed-All-Countries-and-All-States

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/


About

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 99.3%
  • PHP 0.7%