Link to source code: http://github.com/moiristo/settler
Settler can be used for defining application wide settings in Rails. Settings are loaded from a YAML file and stored in the database using ActiveRecord to allow users to update settings on the fly. The YAML configuration allows you to not only specify defaults, but setting value validations and typecasts as well!
Settler originated out of fact that I found that some common features were missing from to existing solutions like binarylogic’s settingslogic and Squeegy’s rails-settings:
- I was looking for something that would enable me to define settings in a file, but could be updated afterwards by users of a given system.
- I wanted to enable users to change settings and therefore had to make sure that these changes would be valid. It should therefore be possible to add validations to settings.
- Instead of being a simple key-value store, I did not want to cast a setting to its appropriate type (string, bool, integer or float) every time I used a certain setting. The configuration should therefore allow me to specify the data type of the setting, which should be properly typecasted every time I used it.
As I found that the aforementioned gems had their own strengths, I decided to use their functionality and combine it into one gem. The added value comes with the validation and typecasting functionality. Please see the Github project page for more info!