We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent adc4ac9 commit 3777373Copy full SHA for 3777373
db/seeds.rb
@@ -11,15 +11,8 @@
11
12
h = Hash.from_xml(open('https://raw.github.com/ChokePointProject/cpp-web/master/tmp/countryInfo.xml'))['geonames']['country']
13
14
-# 1st sweep: continents
15
h.each do |c|
16
- Continent.find_or_create_by_code_and_name(c['continent'], c['continentName'])
17
-end
18
-
19
-# 2nd sweep: countries
20
-h.each do |c|
21
- Country.create(
22
- :continent_id => Continent.find_by_code(c['continent']),
+ n = Country.new(
23
:code => c['countryCode'],
24
:name => c['countryName'],
25
:isoNumeric => c['isoNumeric'],
@@ -36,5 +29,7 @@
36
29
:bBoxEast => c['bBoxEast'],
37
30
:bBoxSouth => c['bBoxSouth']
38
31
)
32
+ n.continent = Continent.find_or_create_by_code_and_name(c['continent'], c['continentName'])
33
+ n.save!
39
34
end
40
35
0 commit comments