Skip to content

Commit c761bf8

Browse files
committed
Add seeds
1 parent 22b3f4e commit c761bf8

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

db/seeds.rb

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
# This file should contain all the record creation needed to seed the database with its default values.
2-
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
3-
#
4-
# Examples:
5-
#
6-
# movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
7-
# Character.create(name: "Luke", movie: movies.first)
1+
# Create a main sample user.
2+
User.create!(name: "Example User",
3+
4+
password: "foobar",
5+
password_confirmation: "foobar")
6+
7+
# Generate a bunch of additional users.
8+
99.times do |n|
9+
name = Faker::Name.name
10+
email = "example-#{n+1}@railstutorial.org"
11+
password = "password"
12+
User.create!(name: name,
13+
email: email,
14+
password: password,
15+
password_confirmation: password)
16+
end

0 commit comments

Comments
 (0)