Reputation: 396
I want to access my ActiveRecord job item after enqueueing a task
job = MyCustomJob.perform_later
Job
is a MyCustomJob
, but how I can access it without doing something like Delayed::Job.last
?
Upvotes: 0
Views: 207
Reputation: 4117
job.provider_job_id
is the Delayed::Job
's id
so you could do Delayed::Job.find(job.provider_job_id)
.
Code is here: https://github.com/rails/rails/blob/master/activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb#L20
Upvotes: 2