environment.rb ruby path issue

I'm attempting to add a path to my rails app by adding the line :         config.load_paths += %W( #{RAILS_ROOT}/new_path ) to my config/environments/development.rb file. For some reason rails doesn't seem to be picking up the module located in this path, however when I add that same line to my config/environment.rb file the module loads up fine. I am definitely running under the dev environment and i am editing the correct rb file as far as I can tell. Any ideas?

Thanks.

Ed wrote:

I'm attempting to add a path to my rails app by adding the line :         config.load_paths += %W( #{RAILS_ROOT}/new_path ) to my config/environments/development.rb file. For some reason rails doesn't seem to be picking up the module located in this path, however when I add that same line to my config/environment.rb file the module loads up fine. I am definitely running under the dev environment and i am editing the correct rb file as far as I can tell. Any ideas?

Thanks.

I don't think you can use an environment-specific initializer. The initializer defined in environment.rb is run before any environment-specific code.

See http://toolmantim.com/article/2006/12/27/environments_and_the_rails_initialisation_process, the section titled "Rails::Initializer.run and per-environment configs".

I see. Let me explain what I'm trying to do any maybe you have some advice. I've got two ruby modules that have the same name and same functionality but are implemented differently. I'd like one of them to be loaded by ruby depending on the environment. I don't want to make any changes to config/environment.rb and would like to keep environment specific changes confined to config/environments/*.rb. What should I be doing to accomplish this?

Thanks a lot.