Maybe this can be of some help..

http://wiki.rubyonrails.org/rails/pages/Environments

On Dec 22, 12:21 pm, Glenn Little <[email protected]> wrote:
> I'm confused about the difference and relationship between
> the RAILS_ENV constant, and ENV['RAILS_ENV'].  What is the
> intent in usage between the two?
>
> My initial thought was that ENV['RAILS_ENV'] was sort of the
> outside world's way of communicating with the rails app, but
> maybe that rails would set RAILS_ENV from that early and then
> just go from there.
>
> But I find plugins and bits of code here and there that use
> ENV['RAILS_ENV'] in decision logic directly, in addition to code
> that uses RAILS_ENV in decision logic.
>
> Is there a "more correct" way?  And when exactly does RAILS_ENV
> get set?
>
> Lastly, in a shell with no RAILS_ENV set, I do:
>
>   % echo $RAILS_ENV
>   RAILS_ENV: Undefined variable.
>
>   % script/console production
>   >> RAILS_ENV
>   => "production"
>   >> ENV['RAILS_ENV']
>   => "development"
>
> Huh?  Where is that "development" coming from?
>
> Pointers to decent documentation on this stuff very much welcomed!
>
> Thanks...
>
>         -glenn
--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---

Reply via email to