Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

environment files do not load correctly

#2811

When I create a new rails project in rails 2.3.2 and I add the following lines to the following environment files:

config/environment.rb
ENV['load_test'] = 'in environement'

config/environments/development.rb
ENV['load_test'] = 'in development'

When I run the console for the development environment and ask for the value of ENV['load_test'], I get 'in environement', but I should get 'in development'.

Reported by dirkbj · June 17th, 2009 @ 03:45 AM

State: invalid
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Jeremy Durham
    Jeremy Durham

    You are probably specifying ENV['load_test'] = 'in environement' after the Rails::Initializer.run block. If you specify it before the block in environment.rb, the development.rb's settings will take precedence. The development.rb runs in the context of the Rails initializer block, so if you make changes at the end of environment.rb after the development.rb file had loaded, then the changes in environment.rb will take precedence.

    I've tested this behavior in Rails 2.2.x and it worked the same in that version as well.

    June 17th, 2009 @ 05:03 AM

  2. dirkbj
    dirkbj

    You are absolutely correct. Sorry for the chatter.

    June 17th, 2009 @ 05:15 AM

  3. CancelProfileIsBroken
    CancelProfileIsBroken
    • State changed from new to invalid

    June 17th, 2009 @ 12:18 PM