Sha256: 538775f0255b108757aece52f8f85e783b8655d6ca8658ed682a516812ce38fe
Contents?: true
Size: 1.55 KB
Versions: 6
Compression:
Stored size: 1.55 KB
Contents
= settings-goo settings-goo is a simple ActiveRecord based model for storing global application settings for your rails application in your database. Settings was designed to be as simple as possible and to mimic a Hash. Data is stored in the database fields :key and :value. The :value field is serialized as json. The possible method_missing magic (ex: Settings.admin_email) was intentionally left off. Keep it simple! You can store any kind of data as your value, i.e. boolean, float, integer, array. == Installation Install the settings-goo gem sudo gem install settings-goo Add the gem to your application configuration config.gem 'settings-goo', :lib => 'settings' == Setup Create the settings migration script/generate settings_migration Run the database migration rake db:migrate == Usage Create some settings: Settings[:admin_email] = 'admin@somewhere.com' Settings[:role_enabled] = true Settings[:per_page] = 1 Settings[:ca_tax] = 0.87 Retrieve some settings: Settings[:admin_email] # returns 'admin@somewhere.com' Settings[:role_enabled] # returns true Settings[:per_page] # returns 1 Settings[:ca_tax] # return 0.87 Update a setting: Settings[:admin_email] = 'admin@somewhere.com' Settings[:admin_email] = 'another.admin@somewhere.com' Settings[:admin_email] # returns 'another.admin@somewhere.com' Remove a setting: Settings.remove(:admin_email) Settings[:admin_email] # returns nil List all setting keys: Settings.keys # returns [:admin_email, :ca_tax, :per_page, :role_enabled]
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
settings-goo-0.3.5 | README.rdoc |
settings-goo-0.3.4 | README.rdoc |
settings-goo-0.3.3 | README.rdoc |
settings-goo-0.3.2 | README.rdoc |
settings-goo-0.3.1 | README.rdoc |
settings-goo-0.3.0 | README.rdoc |