Forum: Ruby on Rails Application settings and retrieval thereof

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.
0a012946a32e22f4c3a5ab6866e98e45?d=identicon&s=25 Dave Smith (smitty1276)
on 2007-02-14 05:18
I'm new to this whole thing, so I thought I'd those with experience.
What is the best way to store and retrieve application settings?  Does
rails have a mechanism already in place for this... something similar to
blah.properties in java and application settings in .NET?
D0cd6b10e01bacb976b3b815a9c660bc?d=identicon&s=25 Alex Wayne (squeegy)
on 2007-02-14 08:45
Dave Smith wrote:
> I'm new to this whole thing, so I thought I'd those with experience.
> What is the best way to store and retrieve application settings?  Does
> rails have a mechanism already in place for this... something similar to
> blah.properties in java and application settings in .NET?

You can create constants in environment.rb that have data in them:

  MY_SETTINGS = {
    :master_user_id => 42,
    :foo => "bar"
  }

Now anywhere in your app you can:

  MY_SETTINGS[:master_user_id] #=> 42

If you want something more flexible and user changeable, check out my
settings plugin:

  http://beautifulpixel.com/svn/plugins/settings/
This topic is locked and can not be replied to.