Seed initial superuser account username, public name and bio
This commit is contained in:
parent
d73da0b138
commit
87a4732823
2 changed files with 15 additions and 5 deletions
|
@ -1,7 +1,13 @@
|
|||
development:
|
||||
email: admin@example.com
|
||||
password: password
|
||||
username: admin
|
||||
public_name: Just Admin
|
||||
biography: I am creator of the website you read this text on.
|
||||
|
||||
production:
|
||||
email: <%= Rails.application.credentials.superuser_email %>
|
||||
password: <%= Rails.application.credentials.superuser_password %>
|
||||
username: kotovalexarian
|
||||
public_name: Alex Kotov
|
||||
biography: I am creator of the website you read this text on.
|
||||
|
|
|
@ -12,8 +12,12 @@ end
|
|||
|
||||
Rails.application.settings(:superuser).tap do |config|
|
||||
User.where(email: config[:email]).first_or_create! do |new_user|
|
||||
new_user.account = Account.create!
|
||||
new_user.password = config[:password]
|
||||
new_user.confirmed_at = Time.zone.now
|
||||
new_user.account = Account.create!(
|
||||
username: config[:username],
|
||||
public_name: config[:public_name],
|
||||
biography: config[:biography],
|
||||
)
|
||||
end.account.add_role :superuser
|
||||
end
|
||||
|
|
Reference in a new issue