Rails

How To Execute Rake Tasks More Than Once

Posted by Weston Ganger on December 22, 2016

I wanted to execute a rake task more than one time inside another rake task. Apparently you cannot just simply do this which is weird. You have to re-enable the task again.


# this will not work
Rake::Task["my_task"].invoke(n,other_arg)
Rake::Task["my_task"].invoke(n,other_arg)


# this will work
Rake::Task["my_task"].invoke(n,other_arg)
Rake::Task["my_task"].reenable
Rake::Task["my_task"].invoke(n,other_arg)


Related External Links:


Posted in Rails and Tagged with rake 


Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts