Sample data for signatures
This commit is contained in:
@@ -5,7 +5,7 @@ class Network::SignatureCollectionsController < ApplicationController
|
|||||||
# GET /network/signature_collections
|
# GET /network/signature_collections
|
||||||
# GET /network/signature_collections.json
|
# GET /network/signature_collections.json
|
||||||
def index
|
def index
|
||||||
@network_signature_collections = Network::SignatureCollection.all
|
@network_signature_collections = Network::SignatureCollection.where(:event_date_start.gte => DateTime.now)
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /network/signature_collections/1
|
# GET /network/signature_collections/1
|
||||||
|
|||||||
@@ -5,3 +5,10 @@
|
|||||||
#
|
#
|
||||||
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
||||||
# Mayor.create(name: 'Emanuel', city: cities.first)
|
# Mayor.create(name: 'Emanuel', city: cities.first)
|
||||||
|
|
||||||
|
@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
|
||||||
|
|||||||
Reference in New Issue
Block a user