Search code examples
ruby-on-railsrake-task

Invoke rake task with arguments from another task


I would like to be able to pass arguments for a task that I have to call from another task

Invoking without arguments works for me like this:

Rake::Task["mytask1"].invoke

However with arguments like this it does not:

Rake::Task["mytask1[1,v18_0,20141230]"].invoke

Thanks


Solution

  • you can try

    Rake::Task[:my_task].invoke(1,'v18_0',20141230)
    

    or you can do

    Rake.application.invoke_task("my_task[1, 'v18_0', 20141230]")