From 9babb2014ba101e8c4a7b7808c3e3624ee7bb8d7 Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Tue, 28 Mar 2006 04:25:31 +0000 Subject: to_xml documentation [DHH, Koz] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4087 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/base.rb | 62 +++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/base.rb') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index e86dad58f5..f6bee7b6ae 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1614,7 +1614,67 @@ module ActiveRecord #:nodoc: @readonly = true end - # Turns this record into XML + # Builds an XML document to represent the model. Some configuration is + # availble through +options+, however more complicated cases should use + # Builder. + # + # By default the generated XML document will include the processing + # instruction and all object's attributes. For example: + # + # + # + # The First Topic + # David + # 1 + # false + # 0 + # 2000-01-01T08:28:00+12:00 + # 2003-07-16T09:28:00+1200 + # Have a nice day + # david@loudthinking.com + # + # 2004-04-15 + # + # + # This behaviour can be controlled with :skip_attributes and :skip_instruct + # for instance: + # + # topic.to_xml(:skip_instruct => true, :skip_attributes => [ :id, bonus_time, :written_on, replies_count ]) + # + # + # The First Topic + # David + # false + # Have a nice day + # david@loudthinking.com + # + # 2004-04-15 + # + # + # To include first level associations use :include + # + # firm.to_xml :include => [ :account, :clients ] + # + # + # + # 1 + # 1 + # 37signals + # + # + # 1 + # Summit + # + # + # 1 + # Microsoft + # + # + # + # 1 + # 50 + # + # def to_xml(options = {}) options[:root] ||= self.class.to_s.underscore options[:except] = Array(options[:except]) << self.class.inheritance_column unless options[:only] # skip type column -- cgit v1.2.3