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,
|
FasterCSV.parse(open(csv_filename), :headers => true,
|
||||||
:header_converters => [:downcase, :symbol]).each do |row|
|
:header_converters => [:downcase, :symbol]).each do |row|
|
||||||
map = self.find_or_initialize_by_name(
|
map = self.find_or_initialize_by_name(
|
||||||
"#{row[:city]}, #{row[:country]}"
|
"#{row[:city]}, #{row[:region]}"
|
||||||
)
|
)
|
||||||
map.save
|
map.save
|
||||||
if block_given?
|
if block_given?
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
country,city
|
region,city
|
||||||
Afghanistan,Kabul
|
Afghanistan,Kabul
|
||||||
Albania,Tirane
|
Albania,Tirane
|
||||||
Algeria,Algiers
|
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}'"
|
puts "Seeded map '#{map.name}'"
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user