Metabolical
Metabolical is an ActiveRecord Model & mixin that adds metadata to your AR classes. Whenever you feel like adding a column to a table ask yourself if what you really want is just some metadata.
Install
gem install
Usage
class User < ActiveRecord::Base
end
user = User.new
user.['active'] = true
user.['active'].data #=> true
User.('active') #=> all users with some metadata keyed as 'active'
User.('active', true) #=> all user with metadata with key 'active' and set to true
User.('asshole') #=> all users that don't have a metadata keyed as 'asshole'.
Notes
Metabolical will need you to run the following migration
create_table :meta_data, :force => true do |t|
t.integer :metabolized_id
t.string :metabolized_type
t.string :key
t.text :data
t.
end
add_index :meta_data, [:metabolized_id, :metabolized_type, :key]