Hello,
I need to have some scripts periodically access the same database as my
Rails application is using and perform some calculations.
From an earlier post, recipe 26 from Rails Recipes was recommended as a
way to configure and run the script. I was looking around on on the
Web and found an article that recommended place my scripts in the
standard rails ‘script’ directory and including the line:
require File.join(File.dirname(FILE), ‘…/config/environment’)
at the beginning of the script. This seems to run fine as well, with
less repetitive configuration. Aside from the overhead of loading the
the Rails environment, what would be the advantages and disadvantages
of each approach?
Also, for the second method what would be the best way to specify the
environment?
Thanks,
Dan