Class: ApplicationJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
/var/apps/qpixel/app/jobs/application_job.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args, **opts) ⇒ ApplicationJob

Returns a new instance of ApplicationJob.



8
9
10
11
# File '/var/apps/qpixel/app/jobs/application_job.rb', line 8

def initialize(*args, **opts)
  @job_id = SecureRandom.uuid
  super
end

Instance Method Details

#exec(sql) ⇒ Object

Note:

CAUTION: This method does NOT parametrize or escape the SQL statement in any way. YOU are responsible for ensuring sql is safe.

Executes a given SQL statement in the context of the current connection

Parameters:

  • sql (String)

    SQL statement to execute



17
18
19
# File '/var/apps/qpixel/app/jobs/application_job.rb', line 17

def exec(sql)
  ApplicationRecord.connection.execute(sql)
end

#loggerObject



21
22
23
# File '/var/apps/qpixel/app/jobs/application_job.rb', line 21

def logger
  Rails.job_logger.tagged(self.class.name, @job_id)
end