This project is archived and is in readonly mode.

#2811 ✓invalid
dirkbj

environment files do not load correctly

Reported by dirkbj | June 17th, 2009 @ 03:45 AM | in 2.x

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'.

Comments and changes to this ticket

  • Jeremy Durham

    Jeremy Durham June 17th, 2009 @ 05:03 AM

    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.

  • dirkbj

    dirkbj June 17th, 2009 @ 05:15 AM

    You are absolutely correct. Sorry for the chatter.

  • CancelProfileIsBroken

    CancelProfileIsBroken June 17th, 2009 @ 12:18 PM

    • State changed from “new” to “invalid”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages