README.rdoc in birkirb-acts_as_serializable-0.1.1 vs README.rdoc in birkirb-acts_as_serializable-0.1.2
- old
+ new
@@ -66,10 +66,30 @@
SimpleClass.new.to_xml => "<texts><text>It's a brave new world</text></texts>"
SimpleClass.new.to_hash(:version => '1.0') => {:text=>"hello world"}
Use classes containing versioned serialization methods:
- WIP
+Given a model in app/models:
+
+ class Person < ActiveRecord::Base
+ acts_as_serializable
+ end
+
+And a serialization in app/serializations/person
+
+ module Serializable
+ module Person
+ class Version_1_1_0
+ def self.serialize(person, builder, options)
+ builder.person do
+ builder.name(person.name)
+ end
+ end
+ end
+ end
+ end
+
+ Person.new(:name => "Birkir").to_xml => "<person><name>Birkir</name></person>"
== Copyright
Author:: Birkir A. Barkarson <birkirb@stoicviking.net>
Copyright:: Copyright (c) 2009