# Convention for checking rails environment

**URL:** <https://www.ruby-forum.com/t/convention-for-checking-rails-environment/150716>\
**Category:** Rails\
**Created:** [October 12, 2008, 12:39am UTC](https://www.ruby-forum.com/t/convention-for-checking-rails-environment/150716 "2008-10-12T00:39:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [October 12, 2008, 12:39am UTC](https://www.ruby-forum.com/t/convention-for-checking-rails-environment/150716/1 "2008-10-12T00:39:58Z")

</div>

Whats the general practice for checking rails environment.

I often find myself having to do: RAILS\_ENV==“development”.

As of recently, I’ve been starting to see more of  
Rails.env==“production”.

Im thinking, we may as well extend “Rails.env” so I could do:

Rails.env.production?  
Rails.env.test?  
Rails.env.development?

Anybody done this? Or any reasons not to?

---

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [October 12, 2008, 12:43am UTC](https://www.ruby-forum.com/t/convention-for-checking-rails-environment/150716/2 "2008-10-12T00:43:04Z")

</div>

If you’re running the latest rails, this is already implemented 🙂

On Sat, Oct 11, 2008 at 7:39 PM, Aryk G.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Rails.env.production?  
> Rails.env.test?  
> Rails.env.development?
> 
> ## Anybody done this? Or any reasons not to?
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Maurício Linhares  
[http://alinhavado.wordpress.com/](http://alinhavado.wordpress.com/) (pt-br) | [http://blog.codevader.com/](http://blog.codevader.com/)  
(en)  
João Pessoa, PB, +55 83 8867-7208
