Problem with Rails 3 "rails server -d"

In my app controller I require a file named "configuration.rb" in the config directory like so

require "config/configuration"

This has been working perfectly fine in Rails 2 in all environments including prod. Having migrated to Rails 3 this works in all environments if I run "rails server" without the daemon option. If I run the server with the daemon option (-d), I get the following error:

"no such file to load -- config/configuration"

I have tried various things including changing the require to:

require Rails.root.join("config/configuration")

But that only changes the error message to:

"Missing helper file helpers/config/configuration.rb"

Any help would be appreciated.

Thanks

Mathias

Wouldn't it be easier to move this to config/initializers/ your_file.rb ?

Therefore Your file would be automatically loaded every time when You fire up an rails server.

Thanks for your answer. The option of moving this source file somewhere Rails 3 will find it is kind of a last resort for me.

What gets me with this issue is that without the daemon option this works (the required file is found) whereas with the daemon option it doesn't work...

Please quote when replying.

mr wrote in post #961520:

Thanks for your answer. The option of moving this source file somewhere Rails 3 will find it is kind of a last resort for me.

In this case, it's not a last resort. Config files (if they're automatically loaded) normally go in config/initializers; if you put it elsewhere, that was probably a mistake. So fix the mistake.

What gets me with this issue is that without the daemon option this works (the required file is found) whereas with the daemon option it doesn't work...

That is strange. Is $: the same in both cases?

Best,

I moved the file and it resolved the issue. But still, why would it work without -d but not with -d. Everything else remains the same...