What is the best way to have a configuration file in Ruby on Rails?
I just want something that will set values that I can use later (paths,
parameters and such). It would be nice if there were an easy way to set
defaults as well, but that isn’t required. I don’t really care if it is
key=value or apache style.
Thanks!
On 14 Dec 2006, at 23:07, Jonathan D. wrote:
What is the best way to have a configuration file in Ruby on Rails?
I just want something that will set values that I can use later
(paths,
parameters and such). It would be nice if there were an easy way
to set
defaults as well, but that isn’t required. I don’t really care if
it is
key=value or apache style.
You could either create constants in your config/environment.rb file
(or config/environments/{development, test, production}.rb) which you
can refer to elsewhere in your code, or you could load, say, a YAML
file in config/environment.rb and assign the YAML to a constant.
Here’s an example of the latter:
http://www.realityforge.org/articles/2006/02/28/flexible-application-
configuration-in-rails
Regards,
Andy S.
Thank you, the article covers what I want to do.