How to run Rake tasks from within Rake tasks?

Posted by Editorial Staff | Updated on

In this example, We have share how to run Rake tasks from within Rake tasks? You want invoke not execute. A little excerpt from my own code showing how to pass variables:

Alternatively, you can make the task depend upon another task as I have done above with :create depending upon clients:creation:checks.

Just to clarify, a namespace is for grouping tasks, so you must actually define the tasks within the namespace as I have above. You can’t simply call tasks from within a namespace.

So your code above should be:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers