Calling a Rails action from the command line

Anyone knows how to call a Rails action from the command line?

I have an action that would update the database. I can call it from a
web browser:

I want to create a cron job that would do this regularly



The proper way of doing this is to pull out the update code into a library (class under lib/), say RadarUpdater in lib/radar_updater.rb. Then you can access it easily from both a Controller and it’s accessible from the outside.

Your cron-job would look like:

          • ruby /path/to/rails/deploy/script/runner -e production “”

and Controller:

def some_action