# Record Count in AR using to\_xml Options

**URL:** <https://www.ruby-forum.com/t/record-count-in-ar-using-to-xml-options/147742>\
**Category:** Rails\
**Created:** [September 4, 2008, 10:59pm UTC](https://www.ruby-forum.com/t/record-count-in-ar-using-to-xml-options/147742 "2008-09-04T22:59:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![freephoneid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3ec8ea/32.png) [@freephoneid](https://www.ruby-forum.com/u/freephoneid)\
**Post date:** [September 4, 2008, 10:59pm UTC](https://www.ruby-forum.com/t/record-count-in-ar-using-to-xml-options/147742/1 "2008-09-04T22:59:15Z")

</div>

Hi,  
I’m new to Ruby & using ROR as a web service. I’m returning XML  
using statement:

@persons = Person.find(:all)  
render :xml =\> persons.to\_xml()

Now, this returns xml fine without any issues. However, it does not  
return the number of records. Lets say there are 2 records returned  
by  
the query as shown below:

\<?xml version="1.0" encoding="UTF-8"?\> Vick John 

Now, I need output xml as shown below which will include count as  
well:

\<?xml version="1.0" encoding="UTF-8"?\> 2 Vick John 

Can anyone help me out???

Thanks in Advance!
