進行耙提供參數我有一個使用的參數一樣,在命令行rake任務:紅寶石
rake sunspot:reindex[, MyModel]
(是的,支架背後的直接逗號是正確的。)
如何我是否在Ruby中指定了相同的rake命令?
不工作的一些嘗試:
Rake::Task['sunspot:reindex'].execute("[, ActsAsTaggableOn::Tagging]")
Rake::Task['sunspot:reindex'].execute([nil, ActsAsTaggableOn::Tagging])
Rake::Task['sunspot:reindex[, ActsAsTaggableOn::Tagging]'].execute
一些其他的建議我可以嘗試別的嗎?
謝謝。我也發現這個不錯的答案:http://stackoverflow.com/questions/825748/how-do-i-pass-command-line-arguments-to-a-rake-task/825832#825832 – Zardoz 2011-02-16 13:01:37