forked from fox-eye/Rails-Seed-All-Countries-and-All-States
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
21 lines (14 loc) · 724 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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/