Created
October 1, 2010 20:18
-
-
Save oliverbarnes/606788 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
'North America' => ['Canada', 'USA'], | |
'South America' => ['Argentina', 'Bolivia', 'Chile'], | |
'Europe' => ['France', 'Netherlands', 'Norway', 'Scotland', 'Spain', 'Sweden'], | |
'United Kingdom' => ['England', 'Ireland'], | |
'Africa' => ['South Africa'], | |
'Asia' => ['China', 'India', 'Japan', 'Malaysia', 'Singapore', 'South Korea', 'Taiwan', 'United Arab Emirates'], | |
'Australasia' => ['Australia', 'Indonesia'] | |
}.map do |continent, countries| | |
#mongomapper doesn't seem to support passing blocks to Model.create! | |
continent = Continent.create!({:name => continent }) | |
countries.each do |country_name| | |
continent.countries << Country.create!({:name => country_name}) | |
end | |
continent.save! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment