2024-12-29 17:12:54 +08:00
|
|
|
# This file should ensure the existence of records required to run the application in every environment (production,
|
|
|
|
# development, test). The code here should be idempotent so that it can be executed at any point in every environment.
|
|
|
|
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
#
|
|
|
|
# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
|
|
|
|
# MovieGenre.find_or_create_by!(name: genre_name)
|
|
|
|
# end
|
2025-01-05 17:50:33 +08:00
|
|
|
|
|
|
|
User.create!(name: "Example User",
|
|
|
|
email: "example@example.com",
|
|
|
|
password: "foobar",
|
2025-01-05 18:27:13 +08:00
|
|
|
password_confirmation: "foobar",
|
|
|
|
admin: true)
|
2025-01-05 17:50:33 +08:00
|
|
|
|
|
|
|
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
|