Class: CreateAdminService

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

Overview

Responsible for creating an administrative user admin

Instance Method Summary collapse

Instance Method Details

#callObject


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

def call
  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.admin!
  end
end