Implements cached database stored settings for rails. Settings are typed. You can't set a boolean setting to an integer.
Add to your Gemfile:
gem "rails_typed_settings"
Generate migration:
$ rails g rails_typed_settings:install
Migrate your database:
$ rake db:migrate
Add a app/services/settings.rb file with contents:
class Settings < RailsTypedSettings::Base
setting :sale, :boolean, :default => false
setting :sale_discount, :float, :default => 0.3
setting :sale_name, :string
end
Reading a setting:
Settings[:sale]
Writing a setting:
Settings[:sale] = true
Get list of all settings
Settings.keys # [:sale, :sale_discount...]
Because of the way its built you cannot store nil/null as settings values
This project rocks and uses MIT-LICENSE.