Pavan Agrawal @ Ruby On Rails
unread,Jan 25, 2008, 5:53:07 AM1/25/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubygems
I recently had to create a cron job that controlled the delivery of
newsletters to a set of subscribers. Unfortunately, the code required
some refactoring, but up until it could be modified, the task still
needed firing at specific intervals.
I had a little trouble finding much on this subject, so here is the
code I eventually used:
./script/runner -e production "app =
ActionController::Integration::Session.new; app.get 'account/
send_newsletters'"
With any luck, this will help another person save a couple of minutes!
Update
Since Rails 1.2, this method of executing rails controller actions has
been throwing an "uninitialized constant
ActionController::Integration" exception. Adding the following line to
your environments.rb file fixes this problem:
require 'action_controller/integration'
Thanks, Dimitry Hristov!
--
Pavan