Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Storage of configuration values in database

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 CHANGELOG.rdoc
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION
Octocat-spinner-32 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.