Sha256: 2bb03dbbc0de80a6e2cb5be637dc68cce351259b49686b2c2cb0bccd36b2b78c

Contents?: true

Size: 1.62 KB

Versions: 1

Compression:

Stored size: 1.62 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]
  
== TODO

  Cache Settings.keys
  Cache Create rails plugin gem

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
settings-goo-0.2.0 README.rdoc