No commit activity in last 3 years
No release in over 3 years
Attribute serializer for AR models
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0.0
~> 1.5.2

Runtime

>= 3.0.0
 Project Readme

AR Attribute Serializer

ar_attribute_serializer is a simple method that allows you to serialize random ActiveRecord Model attributes.

Installation

Define the following in your Gemfile and run bundle install

gem 'ar_attribute_serializer'

Usage

Define a field that is going to be used for storing serialized data and a list of attributes:

class MyModel < ActiveRecord::Base
  attribute_serializer :serialized_data, :apple, :orange, :banana
end

Then you can use those serialized attributes:

>> model = MyModel.new(:apple => 'red')
>> model.apple
=> red
>> model.orange = 'orange'
>> model.banana = 'yellow'
>> model.serialized_data
=> {:apple => 'red', :orange => 'orange', :banana => 'yellow' }

Copyright

(c) 2011 Oleg Khabarov, released under the MIT license