How to create a daily job (cron-like) in Rails ActiveJob?

Stick with the whenever gem or similar gem e.g. chrono, clockwork, rufus-scheduler.

What you're reading in the ActiveJob documentation is a bit confusing, because it could seem as if ActiveJob may be able handle the responsibility of regular scheduling. What the documentation should say IMHO is that the jobs are regularly scheduled by some other system or tool.

So, ActiveJob is about queued jobs?

Yes, it's about Rails providing a standard interface for adding a job to a queue, and calling a perform method. ActiveJob provides the method interfaces that enable adapters for many job-processing queues, backends, immediate runners, etc.


It's working for me:

every 1.day, at: '9:36 am' do
  runner 'SomeJob.perform_later'
end

I'm using whenever and ActiveJob


If you dont want to add a cron job, can put in the end of job a call to repeat the same job 1 day after the first execution

class SomeJob < ApplicationJob      
   def perform(*args) 
     #execution here...
     SomeJob.set(wait_until: Time.now + 1.day).perform_later(...)
   end
end

I know that is not a good pratice