In general, environment.rb is the place where you should perform
configuration. There’s even a comment at the bottom of the file to
You need to consider what it is that you’re actually configuring. If
it’s some string which acts as the application title, you could place
this in a constant:
[ environment.rb, at the end ]
ApplicationName = “I Caught You A Delicious Bass”
and then reference this constant somewhere else. In your example,
because ‘application_name’ doesn’t start with a capital letter, Ruby
assumes that it is a local variable and it is almost certainly lost
within the scope of your ApplicationController (the class defined in
In a nutshell, use constants if you want to set some value that needs
to persist in a different part of Rails. You could even define these
within a module to keep the top-level namespace clear.
On 11/23/06, Christian S. [email protected]
Hmmm, just a thought: Could it be done with YAML, maybe?
Posted via http://www.ruby-forum.com/.