Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 1f4fe5bf74
Fetching contributors…

Cannot retrieve contributors at this time

file 24 lines (16 sloc) 0.658 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
AttributeSerializer
===================

Based on the Attribute Serializer article written by Greg Moreno
http://gregmoreno.ca/preventing-model-explosion-via-rails-serialization/


Example
=======

class User < ActiveRecord::Base
has_serialized :preferences, :show_email => false, :locale => :en
end

u = User.new # automatically assigns the default preferences
u.preferences
=> {:show_email => false, :locale => :en}
 
u.show_email = true # I can change it like an attribute via @user.update_attributes(params[:user])
u.preferences
=> {:show_email => true, :locale => :en }


Copyright (c) 2011 Greg Moreno and Adam Cuppy, released under the MIT license
Something went wrong with that request. Please try again.