Forum: Ruby on Rails Application globals?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E51c6ae07e72cf04ef869868cb8eca6e?d=identicon&s=25 Jake Janovetz (Guest)
on 2005-12-19 22: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
   ANOTHER_WAY = 3

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:

  CONFIG_OPTIONS = [
    ['THIS_WAY', 1],
    ['THAT_WAY', 2],
    ['ANOTHER_WAY', 3]
  ].freeze

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