Agile Tortoise

Greg Pierce’s blog

« Sleep Apnea      Home again, Home again »

Application-wide preferences in Rails

I’m likely missing something obvious, but I haven’t found the proper “rails” way of handling application-wide preferences. I want to store the prefs in the db, probably in a table something like this:

preferences
  id = int(11)
  name = varchar
  type = varchar [boolean/string/int/float/array/etc]
  value = varchar


Then one-time, for the app, load that table, coerce the values as appropriate and expose a single Pref instance to access those values.

Do I put this in environment.rb? That seems like the right place. Any ideas?

Friday, February 10th, 2006 at 9:51 am and is filed under Ruby on Rails. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a Reply