# Where are the environments constant defined?

**URL:** <https://www.ruby-forum.com/t/where-are-the-environments-constant-defined/154394>\
**Category:** Rails\
**Created:** [November 28, 2008, 4:43pm UTC](https://www.ruby-forum.com/t/where-are-the-environments-constant-defined/154394 "2008-11-28T16:43:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bobm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9fc348/32.png) [@bobm](https://www.ruby-forum.com/u/bobm)\
**Post date:** [November 28, 2008, 4:43pm UTC](https://www.ruby-forum.com/t/where-are-the-environments-constant-defined/154394/1 "2008-11-28T16:43:08Z")

</div>

Hi, constants defined in environment.rb are application wide.

But how and where are they stored ? I mean which is the class or module  
to which they are attached ?

Thanks

---

<div class="post-metadata">

**Author:** ![bobm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9fc348/32.png) [@bobm](https://www.ruby-forum.com/u/bobm)\
**Post date:** [November 28, 2008, 4:48pm UTC](https://www.ruby-forum.com/t/where-are-the-environments-constant-defined/154394/2 "2008-11-28T16:48:06Z")

</div>

On Nov 28, 3:43 pm, Bob M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hi, constants defined in environment.rb are application wide.
> 
> But how and where are they stored ? I mean which is the class or module  
> to which they are attached ?

Object. (and there’s nothing special about environment.rb. If you  
define a constant outside of a class or module then it will get set at  
the top level (bearing in mind that ruby’s constant resolution only  
really cares about lexical scope)

Fred

---

<div class="post-metadata">

**Author:** ![bobm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9fc348/32.png) [@bobm](https://www.ruby-forum.com/u/bobm)\
**Post date:** [November 28, 2008, 5:30pm UTC](https://www.ruby-forum.com/t/where-are-the-environments-constant-defined/154394/3 "2008-11-28T17:30:31Z")

</div>

Thanks a lot Fred ! I was totally unaware about this…
