Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

include serializers in ActiveModel::Serialization example

  • Loading branch information...
commit aee07fe135e5e41ff4fc0bc2e0e33d877cceda42 1 parent 2d2c823
@shime shime authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 activemodel/README.rdoc
View
12 activemodel/README.rdoc
@@ -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]
Please sign in to comment.
Something went wrong with that request. Please try again.