loading rails scripts & configs

57 views
Skip to first unread message

zekeo...@gmail.com

unread,
Jan 24, 2008, 5:03:22 PM1/24/08
to simple-daemon
We've got a pretty significantly complex setup with config files in
the config directory, and files in subfolders of the lib directory.
The simple-daemon will load some of the rails env (like the models)
but not some of the other files that we need.

What is the best way to get the right files required? Do we need to do
it explicitly for each file, or is there a way to load the whole rails
environment. They all get loaded properly there.

Thanks.

Jon Dahl

unread,
Jan 24, 2008, 5:49:18 PM1/24/08
to simple-daemon
Hi Zeke - you could load your entire Rails environment into the daemon
script like this:

require File.dirname(__FILE__) + '/../config/environment.rb'

Or you could just load the individual classes one by one. The former
way is simpler, and will ensure that your daemon process has access to
your entire environment. The latter way is a little more work, but
only includes what you need to include.

Let us know if one of those approaches does what you need!

Cheers,
Jon



On Jan 24, 4:03 pm, "zekeonf...@gmail.com" <zekeonf...@gmail.com>
wrote:

zekeo...@gmail.com

unread,
Jan 24, 2008, 6:41:32 PM1/24/08
to simple-daemon
Hi, Jon.

Actually, it was an error on my part. I was using ENV['RAILS_ENV'] in
a part of our config script, which doesn't get set when loading the
script like this. I've fixed the error.

Thanks for the help and quick response!
Reply all
Reply to author
Forward
0 new messages