Files
ch420/db/seeds.rb
T

16 lines
814 B
Ruby
Raw Normal View History

2015-10-02 21:05:03 +02:00
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
2017-12-17 12:27:10 +01:00
@cities = CSV.read Rails.root.join('db', 'plz_ch.csv')
@cities.sample(122).each do |city|
tmp_date = DateTime.now + rand(50)
Network::SignatureCollection.create(location_zip: city.first, location_name: city.last, location_address: Faker::Address.street_address, event_date_start: tmp_date, event_date_end: tmp_date+rand(10).to_f/10)
end
2017-12-17 22:26:09 +01:00
# Network::SignatureCollection.where(location: {"$near" => x.location, '$maxDistance' => 1.fdiv(111.12)}).map &:location_name