Adding a teensy data set for sussing out the tournament logic
This commit is contained in:
parent
d7f0f6c964
commit
8fca34c7ef
@ -25,7 +25,7 @@ class Map < ActiveRecord::Base
|
||||
FasterCSV.parse(open(csv_filename), :headers => true,
|
||||
:header_converters => [:downcase, :symbol]).each do |row|
|
||||
map = self.find_or_initialize_by_name(
|
||||
"#{row[:city]}, #{row[:country]}"
|
||||
"#{row[:city]}, #{row[:region]}"
|
||||
)
|
||||
map.save
|
||||
if block_given?
|
||||
|
@ -1,4 +1,4 @@
|
||||
country,city
|
||||
region,city
|
||||
Afghanistan,Kabul
|
||||
Albania,Tirane
|
||||
Algeria,Algiers
|
||||
|
|
10
rails/map-mash/db/top-us-cities.csv
Normal file
10
rails/map-mash/db/top-us-cities.csv
Normal file
@ -0,0 +1,10 @@
|
||||
city,region
|
||||
Omaha,Nebraska
|
||||
Charlotte,North Carolina
|
||||
Nashville,Tenessee
|
||||
Colorado Springs,Colorado
|
||||
Knoxville,Tenessee
|
||||
Lexington,Kentucky
|
||||
Little Rock,Arkansas
|
||||
Wichita,Kansas
|
||||
Cedar Rapids,Iowa
|
|
@ -10,4 +10,16 @@ namespace :maps do
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user