Is there any way by which controller methods can be used inside Rake task.
Asked
Active
Viewed 334 times
-2
-
Did you try typing your question into google? https://stackoverflow.com/questions/22936245/call-controller-from-rake-task – Rick S Oct 16 '17 at 20:21
1 Answers
1
You can always call your endpoint but my guess is that you need some logic that lives inside your controller. The best approach would be to extract that logic into some service and use that service in both the controller and your rake task. You get the bonus of being able to test it more easily.

vladvel
- 163
- 1
- 8