-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseeds.rb
37 lines (33 loc) · 995 Bytes
/
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
# 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 rails db:seed command (or created alongside the database
# with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
%i(employee supervisor administrator).each do |role_name|
Role.create(name: role_name)
end
employee = User.create(
email: "[email protected]",
password: "password",
password_confirmation: "password",
active: true
)
employee.add_role(:employee)
supervisor = User.create(
email: "[email protected]",
password: "password",
password_confirmation: "password",
active: true
)
supervisor.add_role(:supervisor)
administrator = User.create(
email: "[email protected]",
password: "password",
password_confirmation: "password",
active: true
)
administrator.add_role(:administrator)