Class: Iron::FirstRun

Inherits:
Object
  • Object
show all
Defined in:
app/models/iron/first_run.rb

Constant Summary collapse

ACCOUNT_NAME =
"Iron"

Class Method Summary collapse

Class Method Details

.create!(user_params) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/models/iron/first_run.rb', line 5

def self.create!(user_params)
  ActiveRecord::Base.transaction do
    english_locale = Locale.create!(code: "en", name: "English")

     = Account.create!(name: ACCOUNT_NAME, default_locale: english_locale)

    person = Person.create!(
      email_address: user_params[:email_address],
      password: user_params[:password]
    )

    User.create!(
      authenticatable: person,
      role: :administrator
    )
  end
end