Application settings and retrieval thereof


#1

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?


#2

Dave S. 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/