forked from fixin.me/fixin.me
Add user statuses and seed admin user
This commit is contained in:
20
db/seeds.rb
20
db/seeds.rb
@@ -1,7 +1,13 @@
|
||||
# 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 bin/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)
|
||||
# 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
|
||||
# bin/rails db:seed
|
||||
# command (or created alongside the database with db:setup).
|
||||
# Seeding process should be idempotent.
|
||||
|
||||
User.transaction do
|
||||
User.find_or_create_by!(status: :admin) do |user|
|
||||
user.email = Rails.configuration.admin
|
||||
user.password = 'admin'
|
||||
puts "Admin account '#{user.email}' created with default password '#{user.password}'"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user