Rendering all the elements when calling Array#to_xml

When I call to_xml on an array, I want it to get the XML for all the
elements in it. I’ve defined to_xml in my class.

r.to_xml
=> “12”

a = [r]
=> [#<StatisticsReport:0x3259f38 @video_id=1, @views=2>]

a.to_xml
=> “<?xml version=“1.0”
encoding=“UTF-8”?>\n\n\n”

As you can see, I’ve got an array, with the lone element responding to
to_xml. But when I call to_xml on the array it doesn’t include the
element’s XML. So how do I get it to render the element’s XML as
well?

Pat

On 2/21/07, Pat M. [email protected] wrote:

As you can see, I’ve got an array, with the lone element responding to
to_xml. But when I call to_xml on the array it doesn’t include the
element’s XML. So how do I get it to render the element’s XML as
well?

Pat

I figured it out, and wrote an explanatory blog post at