I want my rails app to periodically do some maintenance work (e.g.
once a day). The maintenance commands can be called by an action under
a maintenance controller.
A friend suggested using crontab, but I’m not sure how to use crontab
to call an action in rails.
to call an action in rails.
Use a runner script which loads up the rails environment for you.
Create a class file and put it in the lib directory. Then you can
call class methods in the file by running:
ruby script/runner “Myclass.mymethod”
Chris
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.