diff options
author | Xavier Noria <fxn@hashref.com> | 2011-02-21 11:42:26 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-02-21 11:42:26 +0100 |
commit | f826e058355606d1b0503b0395519728335324f4 (patch) | |
tree | 4ad040efe6e5691bb408e8ebc0b6df4a216a1730 /activemodel/lib/active_model/serializers | |
parent | cd12c369961a612f6b083fc0e3b877cf59b737f4 (diff) | |
parent | b481574a33764e2db1caf01c233a9c9ac9723780 (diff) | |
download | rails-f826e058355606d1b0503b0395519728335324f4.tar.gz rails-f826e058355606d1b0503b0395519728335324f4.tar.bz2 rails-f826e058355606d1b0503b0395519728335324f4.zip |
Merge branch 'master' of git://github.com/lifo/docrails
Diffstat (limited to 'activemodel/lib/active_model/serializers')
-rw-r--r-- | activemodel/lib/active_model/serializers/xml.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/serializers/xml.rb b/activemodel/lib/active_model/serializers/xml.rb index b897baa614..d4295e6afe 100644 --- a/activemodel/lib/active_model/serializers/xml.rb +++ b/activemodel/lib/active_model/serializers/xml.rb @@ -134,6 +134,29 @@ module ActiveModel # 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 |