Permalink
Browse files

include serializers in ActiveModel::Serialization example

  • Loading branch information...
shime committed Oct 19, 2012
1 parent 2d2c823 commit aee07fe135e5e41ff4fc0bc2e0e33d877cceda42
Showing with 12 additions and 0 deletions.
  1. +12 −0 activemodel/README.rdoc
View
@@ -168,7 +168,19 @@ behavior out of the box:
s = SerialPerson.new
s.serializable_hash # => {"name"=>nil}
+
+ class SerialPerson
+ include ActiveModel::Serializers::JSON
+ end
+
+ s = SerialPerson.new
s.to_json # => "{\"name\":null}"
+
+ class SerialPerson
+ include ActiveModel::Serializers::Xml
+ end
+
+ s = SerialPerson.new
s.to_xml # => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<serial-person...
{Learn more}[link:classes/ActiveModel/Serialization.html]

0 comments on commit aee07fe

Please sign in to comment.