system-settings is a plugin makes it easy to store application settings in the database as key-value pairs. The data is stored in a table named system_settings with three columns; id, name and value. The ActiveRecord model SystemSetting allows access to the settings via array functions such as;
SystemSetting # nil SystemSetting = ‘bar’ SystemSetting # ‘bar’
You can generate the migration, a test and a sample fixture by running the generator ‘system_settings’ via a command such as;
ruby script/generate system_settings
The plugin can also return the version of the database. The version is made up of the version string extracted from the schema_info table combined with the SystemSetting if it exists. The name of the method is db_version and it is injected into ActiveController:Base and exposed as a helper method.
This plugin can also ensure that the application constant RAILS_ENV matches the database environment by checking that SystemSetting == RAILS_ENV. When the environment does not match an exception is thrown. To enable this functionality add the following line to your ApplicationController
self.check_environment
The plugin also provides a generator for generating a controller that can display system information via a command such as;
ruby script/generate sysinfo_controller
License: Released under the MIT license. Latest Version: www.realityforge.org/svn/public/code/system-settings/trunk/
RedHill Consulting, Pty. Ltd. for the initial work on a similar plugin. Peter Donald <peter at realityforge dot org>.