Permalink
Browse files

Docs: Update to_xml documentation to match as_json docuemntation

  • Loading branch information...
1 parent 26a5068 commit 170032952624494befb2dd65ae49029389d1767e @nixterrimus nixterrimus committed with bowsersenior Feb 21, 2011
Showing with 25 additions and 0 deletions.
  1. +25 −0 activemodel/lib/active_model/serializers/xml.rb
@@ -134,6 +134,31 @@ def add_procs
# Returns XML representing the model. Configuration can be
# passed through +options+.
+ #
+ # Without any +options+, the returned XML string will include all the model's
+ # attributes. For example:
+ #
+ # konata = User.find(1)
+ # konata.to_xml
+ #
+ # <?xml version="1.0" encoding="UTF-8"?>
+ # <user>
+ # <id type="integer">1</id>
+ # <name>David</name>
+ # <age type="integer">16</age>
+ # <created-at type="datetime">2011-01-30T22:29:23Z</created-at>
+ # </user>
+ #
+ # The <tt>:only</tt> and <tt>:except</tt> options can be used to limit the attributes
+ # included, and work similar to the +attributes+ method.
+ #
+ # To include the result of some method calls on the model use <tt>:methods</tt>
+ #
+ # To include associations use <tt>:include</tt>
+ #
+ # For further documentation see activerecord/lib/active_record/serializers/xml_serializer.xml
+
+
def to_xml(options = {}, &block)
Serializer.new(self, options).serialize(&block)
end

0 comments on commit 1700329

Please sign in to comment.