Cron job not working in Whenever gem

后端 未结 4 2298
轮回少年
轮回少年 2020-12-04 10:35

I have an application that contains a bunch of tasks, and every day I want to run a cron job that creates a DayTask for each Task in the database. A Task has_many DayTasks a

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-04 11:13

    You have to actually register the job with the crontab by running:

    whenever --update-crontab

    Also if you're trying to get jobs running locally, add :environment => "development" to your task

    runner "MyTask.some_action", :environment => "development"

提交回复
热议问题