Class: CreateAdminService

Inherits:
Object
  • Object
show all
Defined in:
app/services/create_admin_service.rb

Instance Method Summary collapse

Instance Method Details

#callObject


2
3
4
5
6
7
8
9
# File 'app/services/create_admin_service.rb', line 2

def call
  user = User.find_or_create_by!(email: Rails.application.secrets.admin_email) do |user|
      user.password = Rails.application.secrets.admin_password
      user.password_confirmation = Rails.application.secrets.admin_password
      user.confirm!
      user.admin!
    end
end