Skip to content

Commit d10975a

Browse files
authored
Seed now adds some events relative to now (#110)
1 parent ff5e869 commit d10975a

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

db/seeds.rb

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,41 @@
99
# end
1010
#
1111
zone = 'Eastern Time (US & Canada)'
12+
sponsors = [
13+
{
14+
name: 'Switch',
15+
logo: 'switch.png',
16+
link: 'https://switchgrowth.com'
17+
},
18+
{
19+
name: 'Shopify',
20+
logo: 'shopify.png',
21+
link: 'https://shopify.com'
22+
},
23+
{
24+
name: 'Clio',
25+
logo: 'clio.png',
26+
link: 'https://clio.com'
27+
}
28+
]
29+
30+
15.times do
31+
sponsor = sponsors.sample
32+
before_after = rand(10) > 5
33+
now = Time.now.utc
34+
time = before_after ? now + rand(7).days : now - rand(7).days
35+
Event.create(
36+
name: SecureRandom.hex(8),
37+
location: "Location #{SecureRandom.hex(8)}",
38+
description: "Description #{SecureRandom.hex(8)}",
39+
sponsor: sponsor[:name],
40+
sponsor_logo: sponsor[:logo],
41+
sponsor_link: sponsor[:link],
42+
status: :published,
43+
start_at: time
44+
)
45+
end
46+
1247
events = [
1348
{
1449
name: 'Inaugural Edition',

0 commit comments

Comments
 (0)