This project is archived and is in readonly mode.

#1345 ✓wontfix
Ernesto Jiménez

Array#to_xml accepts :root_attrs

Reported by Ernesto Jiménez | November 7th, 2008 @ 06:50 PM | in 2.x

You can define root attributes using :root_attrs option:

@projects.to_xml(:root_attrs => {:page => 1, :per_page => 3})

<?xml version="1.0" encoding="UTF-8"?>
<projects page="1" per_page="3" type="array">
  <project>
    <name>project 1</name>
  </project>
  <project>
    <name>project 2</name>
  </project>
  <project>
    <name>project 3</name>
  </project>
</projects>

This is useful for paginated XMLs

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Tags

Pages