[Rails] Running external scripts that know about a minimal Rails env

Nate Agrin
Tue, 04 Apr 2006 02:14:10 -0000

I''ve been exploring the options for running external scripts from the
Rails env.

The list I have is this:

Cron
ScriptRunner (in the script/ dir under rails projects)
RailsCron

The most likely candidate for me is the ScriptRunner because my external
script needs to know about a model which it has to save to the database
from my Rails environment, and it needs to start running as soon as I
tell it to.  Unfortunately, running this external command many times in
a row is a bottleneck since each ScriptRunner instance has to load up
the entire rails env.

What I''m wondering is what is the easiest way to create a script which
knows only about the model I need to work with, and it''s database
location, so that my script doesn''t need to load the entire Rails env.

I''m thinking if I can load the activerecord gem with a slim config
setup, that might work, but I''m not sure how to use activerecord
outside
the context of the Rail''s env.

Anyone else ever tackle this issue?

--
Posted via http://www.ruby-forum.com/.