Rails cron with whenever, setting the environment

前端 未结 10 2107
孤街浪徒
孤街浪徒 2021-01-30 13:15

This question will probably only make sense if you know about the whenever gem for creating cron jobs. I have a task in my schedule.rb like

every 1.day, :at =&g         


        
10条回答
  •  终归单人心
    2021-01-30 14:07

    Whenever doesn't detect your environment, it just defaults to using production. You can set the environment for all jobs using set:

    set :environment, 'staging' 
    

    Or per job:

    every 2.hours do 
      runner 'My.runner', :environment => 'staging' 
    end 
    

提交回复
热议问题