Forum: Ruby on Rails Application globals?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jake J. (Guest)
on 2005-12-19 23:51
I'm curious how best to handle global constants in a Rails application.
That is, where do they go?  I've seen a couple of possible places -- a
module, the 'application.rb'.

Let's say I have a user-selectable configuration "config" that is stored
in a table as an INTEGER.  The user could select among:

   THIS_WAY = 1
   THAT_WAY = 2

Rather than testing config==2 through the application, I'd rather do
"config=='THAT_WAY'".  Am I correct is thinking that my application.rb
should have something like:

    ['THIS_WAY', 1],
    ['THAT_WAY', 2],
    ['ANOTHER_WAY', 3]

Or is there a better method?
This topic is locked and can not be replied to.