Using a config file

Here’s one way

You can make your own yaml file

yml file might look like this

production:

email_server: smtp.mycompany.com

Then load the configuration file in environment.rb (or in a model, or something else)

c = YAML::load(File.open(File.dirname(FILE) + “/my_config.yml”))

c is now a hash… so get the values from the hash

server = c[RAILS_ENV][“email_server”]

I’ve got a writup on something like this for email configs.

http://www.bphogan.com/learn/pdf/tableless_contact_form.pdf

There’s also a plugin that lets you do system settings:

http://agilewebdevelopment.com/plugins/system_settings

but I’ve not used that one.