0

So I have a pretty simple rake task, it looks like such:

#Clean User
 desc "Wipes User"
 task :clean_user, [:emp] => :environment do |t, args|
 Core::User.find(args[:emp]).destroy
end

Simple right? Essentially it takes in a ID and wipes the user. So I run the rake task as bundle exec rake clean_user 123

The 123 is just any sample number, however the weird thing is the error I get back, which essentially says:

"Error could not find user with ID = My Working Directory Path"

Of course replace My Working Directory Path with /usr/me/documents/folders/etc....

This makes no sense? It's like it's not taking in the actual 123 number? Are my arguments setup wrong for taking in Parameters from Command Line?

Thanks

msmith1114
  • 2,717
  • 3
  • 33
  • 84
  • see http://stackoverflow.com/questions/825748/how-to-pass-command-line-arguments-to-a-rake-task?rq=1 for how to add command line parameters to rake tasks – Louis Sep 08 '16 at 16:02

1 Answers1

1

Rake task arguments are not passed like that on the command line. Try this:

bundle exec rake clean_user[123]
Thilo
  • 17,565
  • 5
  • 68
  • 84