From 34316d8b7e6b830e97ebbe124ac6d9a19ce77d2d Mon Sep 17 00:00:00 2001 From: Nicholas Rowe Date: Sun, 20 Feb 2011 21:35:43 -0500 Subject: Docs: Update to_xml documentation to match as_json docuemntation --- activemodel/lib/active_model/serializers/xml.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'activemodel/lib/active_model/serializers') diff --git a/activemodel/lib/active_model/serializers/xml.rb b/activemodel/lib/active_model/serializers/xml.rb index b897baa614..0b0116d32c 100644 --- a/activemodel/lib/active_model/serializers/xml.rb +++ b/activemodel/lib/active_model/serializers/xml.rb @@ -134,6 +134,31 @@ 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 + # + # + # + # 1 + # David + # 16 + # 2011-01-30T22:29:23Z + # + # + # The :only and :except 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 :methods + # + # To include associations use :include + # + # For further documentation see activerecord/lib/active_record/serializers/xml_serializer.xml + + def to_xml(options = {}, &block) Serializer.new(self, options).serialize(&block) end -- cgit v1.2.3 From 843a5b9a3aa3e20f3a3b50fea16351dcddcfde75 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 21 Feb 2011 11:00:03 +0100 Subject: copy-edits 34316d8 --- activemodel/lib/active_model/serializers/xml.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'activemodel/lib/active_model/serializers') diff --git a/activemodel/lib/active_model/serializers/xml.rb b/activemodel/lib/active_model/serializers/xml.rb index 0b0116d32c..d4295e6afe 100644 --- a/activemodel/lib/active_model/serializers/xml.rb +++ b/activemodel/lib/active_model/serializers/xml.rb @@ -146,19 +146,17 @@ module ActiveModel # 1 # David # 16 - # 2011-01-30T22:29:23Z + # 2011-01-30T22:29:23Z # # # The :only and :except 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 :methods # - # To include associations use :include + # To include the result of some method calls on the model use :methods. # - # For further documentation see activerecord/lib/active_record/serializers/xml_serializer.xml - - + # To include associations use :include. + # + # For further documentation see activerecord/lib/active_record/serializers/xml_serializer.xml. def to_xml(options = {}, &block) Serializer.new(self, options).serialize(&block) end -- cgit v1.2.3