8000 GitHub - lukewendling/app_attributes: Add simple name-value pairs to any ActiveRecord model
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

lukewendling/app_attributes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AppAttributes

A very simple polymorphic implementation of name-value pairs for any ActiveRecord model. The value is serialized to allow storage of ruby objects.

Install

sudo gem install app_attributes

OR

gem 'app_attributes'
bundle install

Usage

in your model:

class Author < ActiveRecord::Base
  include AppAttributes

  ext_attribute :hat_size, 10, :to_i
  # args: attribute name, default value, casting method for returned value
  # provides @author.hat_size, @author.hat_size=, @author.hat_size?
  # returns value cast as integer
end

TODO

  • automate db migration. currently, you must manually copy/rename migration file in app_attributes/db/migrate
  • build out tests likely as a nested Rails app

Copyright and license

Copyright (c) 2011 Luke Wendling, released under the New BSD License

Contributors:

  • Jeff Pihl
  • Scott Robertson
  • Mike Hansen

About

Add simple name-value pairs to any ActiveRecord model

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

0