box-o-sand/rails/map-mash/lib/tasks/maps.rake

26 lines
603 B
Ruby

namespace :maps do
desc 'Seed the maps!'
task :seed => :environment do
require 'app/models/map'
csv_filename = File.expand_path(
'../../db/capital-cities.csv', File.dirname(__FILE__)
)
Map.import(csv_filename) do |map|
puts "Seeded map '#{map.name}'"
end
end
desc 'Seed the maps a little bit less!'
task :miniseed => :environment do
require 'app/models/map'
csv_filename = File.expand_path(
'../../db/top-us-cities.csv', File.dirname(__FILE__)
)
Map.import(csv_filename) do |map|
puts "Seeded map '#{map.name}'"
end
end
end