-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseeds.rb
51 lines (41 loc) · 1.41 KB
/
seeds.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
User.create!(name: "Example User",
email: "[email protected]",
password: "foobar",
password_confirmation: "foobar",
admin: true)
99.times do |n|
name = Faker::Name.name
email = "example-#{n+1}@railstutorial.org"
password = "password"
User.create!(name: name,
email: email,
password: password,
password_confirmation: password)
end
10.times do
title = Faker::Company.industry
Category.create!(title: title)
end
users = User.order(:created_at).take(10)
users.each { |user|
10.times do |n|
title = Faker::Company.name
description = Faker::Team.state
start_date = DateTime.new
duration = Random.rand(10000)
total_amt = 10000 + Random.rand(10000)
Category.find(n + 1).projects << user.projects.create!(title: title,
description: description,
start_date: start_date,
duration: duration,
total_amt: total_amt)
end
}
users.each { |user|
10.times do |n|
amount = Random.rand(1000)
user.fund_records.create!(amount: amount,
project_id: Random.rand(100),
user_id: user.id)
end
}