Class: Aoa::AuthCreationWorker

Inherits:
ApplicationWorker
  • Object
show all
Defined in:
app/workers/aoa/auth_creation_worker.rb

Instance Method Summary collapse

Instance Method Details

#perform(permitted_params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'app/workers/aoa/auth_creation_worker.rb', line 4

def perform(permitted_params)
  permitted_params = if permitted_params.respond_to?(:with_indifferent_access)
                       permitted_params.with_indifferent_access
                     else
                       eval(permitted_params).with_indifferent_access
                     end
  contact_id = permitted_params[:contact_id]
  auth = AoaAuth.find_or_initialize_by(contact_id: contact_id)
  auth.attributes = permitted_params
  auth.save
end