No commit activity in last 3 years
No release in over 3 years
A simple alternative to acts_as_eav_model. Use JSON to store extra attrubutes.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 2.6.0
~> 1.3.3

Runtime

 Project Readme

extra_attributes

by Manic http://tech.manic.tw

LINKS:

INSTALLATION:

gem install extra_attributes

USAGE:

Create the migration for your model

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

Configure extra_attributes in you config/application.rb

require File.expand_path('../boot', __FILE__)

require 'rails/all'
require 'extra_attribute' # Add this line to enable

Configure extra_attributes in your model

class Person < ActiveRecord::Base
  include ExtraAttribute

  extra_attributes :extra_data, [:name, :nickname] # This sets up the column for your custom attributes
end

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

person = Person.new
person.name = 'Joe'
person.nickname = 'Joey'
person.name ~> 'Joe'
person.nickname ~> 'Joey'

person = Person.new :name => 'Joe'
person.save!
person.name ~> 'Joe'

LICENSE:

Apache License 2.0

Copyright (c) 2012, PIXNET

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.