Class: DemoMode::AccountGenerationJob

Inherits:
Object
  • Object
show all
Defined in:
app/jobs/demo_mode/account_generation_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(session) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'app/jobs/demo_mode/account_generation_job.rb', line 5

def perform(session)
  session.with_lock do
    persona = session.persona
    raise "Unknown persona: #{session.persona_name}" if persona.blank?

    signinable = persona.generate!(variant: session.variant, password: session.signinable_password)
    session.update!(signinable: signinable)
  end
  raise "Failed to create signinable persona!" if session.signinable.blank?
end