Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Universal ActiveRecord store for global configuration settings
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app/models
assets
test
README
Rakefile
install.rb

README

SettingsStore
=============

SettingsStore is a simple Rails plugin that allows to store global configuration settings 
in your database, using an ActiveRecord model.

It is designed to provide convenient access to your settings and stores any type of 
data using AR's build-in YAML serialization.


Installation
============

Run from your project's root:
./script/plugin install git://github.com/odadata/settings_store.git

Please be aware that Rails 2.3.x currently has a bug that prevents the plugin's install from running,
which is why you need to copy the migration from assets/create_settings_store.rb manually to db/migrate.
Don't forget to add a timestamp as well, so that your copy command will look like this:
cp assets/create_settings_store.rb ../../../db/migrate/20090918220100_create_settings_store.rb


Example
=======

Configuration options can be stored and received using the method call notation on the Settings model:

Settings.my_conf_option = 'some string'
Settings.my_conf_option

Be aware that by default if you try to receive an option that can not be found in the database,
a Setting::SettingNotFound exception is raised.
If you prefer to disable this behavior, set Setting.raise_exception to false from one of your initializers.
This will make Setting return nil for unknown options.


Caching
=======

The SettingsStore plugin uses ActiveSupport's cache backend (available through Rails.cache) to improve performance.
I recommend using memcached as a backend there for best results.
All settings are stored with a '_settings_store/' prefix to avoid conflicts with your existing cache keys.


Copyright (c) 2009 Pascal Ehlert, released under the MIT license
Something went wrong with that request. Please try again.