# Getting environment?

**URL:** <https://www.ruby-forum.com/t/getting-environment/141628>\
**Category:** Rails\
**Created:** [June 27, 2008, 10:56pm UTC](https://www.ruby-forum.com/t/getting-environment/141628 "2008-06-27T22:56:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chovy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecd19e/32.png) [@chovy](https://www.ruby-forum.com/u/chovy)\
**Post date:** [June 27, 2008, 10:56pm UTC](https://www.ruby-forum.com/t/getting-environment/141628/1 "2008-06-27T22:56:22Z")

</div>

How do I get the environment my app is running in from with rails?

I want to add a small note in the footer for [test.example.com](http://test.example.com) and  
[stage.example.com](http://stage.example.com) environments.

–  
Anthony E.  
408-656-2473  
[http://anthony.ettinger.name](http://anthony.ettinger.name)

---

<div class="post-metadata">

**Author:** ![chovy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecd19e/32.png) [@chovy](https://www.ruby-forum.com/u/chovy)\
**Post date:** [June 27, 2008, 11:00pm UTC](https://www.ruby-forum.com/t/getting-environment/141628/2 "2008-06-27T23:00:28Z")

</div>

> How do I get the environment my app is running in from with rails?
> 
> I want to add a small note in the footer for [test.example.com](http://test.example.com) and  
> [stage.example.com](http://stage.example.com) environments.

RAILS\_ENV

There’s a new way in edge (or maybe 2.1, don’t recall), but I also  
don’t recall the string. Heh.

-philip

---

<div class="post-metadata">

**Author:** ![chovy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecd19e/32.png) [@chovy](https://www.ruby-forum.com/u/chovy)\
**Post date:** [June 27, 2008, 11:01pm UTC](https://www.ruby-forum.com/t/getting-environment/141628/3 "2008-06-27T23:01:38Z")

</div>

> > How do I get the environment my app is running in from with rails?
> > 
> > I want to add a small note in the footer for [test.example.com](http://test.example.com) and  
> > [stage.example.com](http://stage.example.com) environments.
> 
> RAILS\_ENV
> 
> There’s a new way in edge (or maybe 2.1, don’t recall), but I also  
> don’t recall the string. Heh.

Typical. I find it right after hitting send 🙂

[http://blog.codefront.net/2008/04/06/living-on-the-edge-of-rails-15-the-early-edition/](http://blog.codefront.net/2008/04/06/living-on-the-edge-of-rails-15-the-early-edition/)

Quoting…

This has been a long time coming: You can now use Rails.env instead of  
RAILS\_ENV, Rails.root instead of RAILS\_ROOT, Rails.logger instead of  
RAILS\_DEFAULT\_LOGGER, and Rails.cache instead of RAILS\_CACHE. Not  
having to use constants is nice because it always felt a bit dirty to  
have so many hard-coded constants in the Rails namespace.
