The XML generated by default will include all attributes for the object, and a type attribute
for attributes that are not of type String. In addition, associations are not expanded by default.
An example of the XML for an object of our Account class would be
1
Pytel
Chad
1
Valid options for the options hash are :skip_instruct, :root, :except, :only, and :include.
The :skip_instruct option, if set to true, will cause the XML processing instruction line to be
excluded from the resulting XML:
account.to_xml(:skip_instruct => true)
# =>
1
Pytel
Chad
1
2006-11-10T10:22:56-05:00
The default name for the root element is the class name of the Active Record object we are
formatting. The :root option should be a string and allows you to override the name of the
root element:
account.
Pages:
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513