Find file
Fetching contributors…
Cannot retrieve contributors at this time
64 lines (42 sloc) 2.13 KB



Version 1.0.0, is only compatible with >= 3.1. If you are still bound to < 3.1 please use an older version of this gem.

simple_eav provides a more simple alternative to acts_as_eav_model that works with ActiveRecord without any monkey patching. This gem is designed to be a replacement for acts_as_eav_model.

Acts_as_eav_model's purpose is to provide a model with any number of custom attributes. This project has the same purpose. The difference being maintaining utmost compatibility with ActiveRecord::Base.

This library, to my knowledge, is fully compatible with acts_as_eav_model. This update introduced the ability to specify custom attributes exactly the same as attributes with an actual column in the database ie:

Person.create :attribute_with_column=>true, :attribute_without_column=>true


gem install simple_eav


1. Create the migration for your model

create_table :people do |t|
  t.text  :custom_attributes # Name this column whatever you like just *make sure* it is a TEXT field

2. Configure simple_eav in your model

class Person < ActiveRecord::Base
  include SimpleEav

  configure_simple_eav :custom_attributes # This sets up the serialization for your custom attributes

3. Set and Get custom attributes as if they were a normal attribute on your model

person = = 'Joe' ~> 'Joe'

person = :name => 'Joe'! ~> 'Joe'


  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.


Tim Linquist


Copyright © 2011 Tim Linquist

See LICENSE for details.