我试图在终端中使用多个参数运行我的rake任务,但是我一直收到错误:
rake populate:user['a' 'a']
DL is deprecated, please use Fiddle
rake aborted!
Don't know how to build task 'populate:user[a'
我的rake文件:
namespace :populate do
desc 'Populate data into our database'
task :user, [:username, :password] => :environment do |t, args|
// do stuff, also doesn't work when I delete everything inside here
end
end
我也试过
rake populate:user[a, a]
它没有任何参数运行:
rake populate:user
答案 0 :(得分:6)
您可以尝试使用
rake 'populate:user[a,a]'
您也可以参考https://cobwwweb.com/4-ways-to-pass-arguments-to-a-rake-task
答案 1 :(得分:0)
使用以下内容:
rake populate:user[a,a]
不应该在整个rake任务或每个参数周围添加引号(我不认为)。