排队作业后如何访问ActiveRecord作业

时间:2017-08-25 18:45:56

标签: ruby-on-rails delayed-job rails-activejob

我想在排队任务后访问我的ActiveRecord工作项

job = MyCustomJob.perform_later 

Job是一个MyCustomJob,但我如何在不执行Delayed::Job.last之类的情况下访问它?

1 个答案:

答案 0 :(得分:1)

Expression<Func<TEntity, object>>var master = MasterRepository.Get(1, x => x.Details.Select(y=> y.Product)); 的{​​{1}},因此您可以job.provider_job_id

代码在这里:https://github.com/rails/rails/blob/master/activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb#L20