Skip to content

Instantly share code, notes, and snippets.

@oliverbarnes
Created October 1, 2010 20:18
Show Gist options
  • Save oliverbarnes/606788 to your computer and use it in GitHub Desktop.
Save oliverbarnes/606788 to your computer and use it in GitHub Desktop.
{
'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