3

Rake tasks scheduled in Heroku found online are in the "rake task-name" format. Heroku passes in an :environment argument to the rake task, but there is no documentation about extra args being passed to a task listed in scheduler.rake

Heroku Scheduler Doc

4

2 回答 2

2

而不是Heroku Scheduler 主屏幕中 Task 列接受的字符串输入rake task_namerake task_name[arg1, arg2]

正如 CodeGroover 所提到的,您定义的 rake 任务lib/scheduler.rake应该定义它所期望的参数。

于 2015-01-08T16:22:43.910 回答
2

你可以试试这个:

task :my_task, [:arg1, :arg2] => :environment do |t, args|
  puts "Args were: #{args}"
end

然后手动运行查看输出:

heroku run rake my_task

更新:

这个答案可能已经是旧的了

于 2013-10-07T13:03:30.733 回答