app/models/operation.rb
# Enqueues the appropriate OperationJob to be run later.
# Passes self and the contents of the job_params attrib (with double splat) to the perform_later method.
# Since job_params is ephemeral, enqueue should be called right after the operation is created, not
# on an operation object retrieved from the DB.
Enqueues the appropriate OperationJob to be run later.
Passes self and the contents of the job_params attrib (with double splat) to the perform_later method.
Since job_params is ephemeral, enqueue should be called right after the operation is created, not
on an operation object retrieved from the DB.
Enqueues the appropriate OperationJob to be run later . Passes self and the contents of the job_params attrib ( with double splat ) to the perform_later method . Since job_params is ephemeral enqueue should be called right after the operation is created not on an operation object retrieved from the DB .
def enqueue
    save! unless persisted?
    job = job_class.constantize.perform_later(self, **job_params)
    update!(job_id: job.job_id, provider_job_id: job.provider_job_id)
  end
def enqueue save! unless persisted? job = job_class . constantize . perform_later ( self , ** job_params ) update! ( job_id : job . job_id , provider_job_id : job . provider_job_id ) end
Enqueues the appropriate OperationJob to be run later.
Enqueues the appropriate OperationJob to be run later .
# We need to save before passing to perform_later b/c perform_later will need our ID. # For this reason, the job_id col can't have a null constraint.