Skip to content
Storage of configuration values in database
Ruby
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
spec
.gitignore
CHANGELOG.rdoc
LICENSE
README.rdoc
Rakefile
VERSION
acts_as_configurable.gemspec

README.rdoc

Acts as configurable

Provides the capabilities of defining configuration values for a model.

Installation

gem install acts_as_configurable

Initialisation

Migration:

create_table :configurations do |t|
  t.string :name, :value, :null => false
  t.string :configurable_type
  t.integer :configurable_id
end

Configuration model:

class Configuration < ActiveRecord::Base
  belongs_to :configurable, :polymorphic => true
end

Usage

class User < ActiveRecord::Base
 	acts_as_configurable :class_name => 'Configuration'
end

user.configure.name = 'Name'
user.configure.name # => Name
Something went wrong with that request. Please try again.