System-wide db-driven config

Hi folks,

Just after a 'best-practise' pointer with this one really;

I have a 'setup' model for my application which only has a single record, holding the current settings of the app e.g. its mode (maintenance, normal, readonly) etc

I need to check the app's settings, at least once per page-load, sometimes more.

I know I could do this easily by pulling the record each time but was wondering if using global variables or something like a helper would be better? I do need to make these calls in both the controllers and views however.

Thanks in advance,


I use a DB table but store one value per setting. Then in my code I just access whichever record I need to gain access to the value. This gives me great flexibility to maintain the setting values. Then I access the table only when needed. It might not be as fast as having all values retrieved at once but in my case it does not make any real difference in the performance of the application.