# Possible bug in ActiveRecord::Base#to\_xml and caching

**URL:** <https://www.ruby-forum.com/t/possible-bug-in-activerecord-base-to-xml-and-caching/91309>\
**Category:** Rails\
**Created:** [April 6, 2007, 3:31pm UTC](https://www.ruby-forum.com/t/possible-bug-in-activerecord-base-to-xml-and-caching/91309 "2007-04-06T15:31:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jruyle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d2c977/32.png) [@jruyle](https://www.ruby-forum.com/u/jruyle)\
**Post date:** [April 6, 2007, 3:31pm UTC](https://www.ruby-forum.com/t/possible-bug-in-activerecord-base-to-xml-and-caching/91309/1 "2007-04-06T15:31:42Z")

</div>

So I’ve got this weird problem showing up in the production environment  
to  
where when I grab xml from resources, the xml results get cached, but  
not  
used. This means that every subsequent request appends the results to  
the  
cache.

This happens when config.cache\_class = true; happens in both WEBrick and  
my  
Apache2 fastcgi deploy.

And an example run:

C:\Development\AdminPortal\proto\>wget  
[http://localhost:3000/phone\_carriers.xml](http://localhost:3000/phone_carriers.xml)  
…  
09:21:34 (869.14 KB/s) - `phone\_carriers.xml’ saved [890/890]

C:\Development\AdminPortal\proto\>wget  
[http://localhost:3000/phone\_carriers.xml](http://localhost:3000/phone_carriers.xml)  
…  
09:21:35 (1.70 MB/s) - `phone\_carriers.xml.1’ saved [1780/1780]

C:\Development\AdminPortal\proto\>wget  
[http://localhost:3000/phone\_carriers.xml](http://localhost:3000/phone_carriers.xml)  
…  
09:21:36 (2.55 MB/s) - `phone\_carriers.xml.2’ saved [2670/2670]

As you can see, the exact same request returns increasingly larger  
results.  
There are only 5 records being returned here, but the 2nd request gives  
me  
the results twice, and the third request gives me the results a third  
time:

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

I’m currently looking into the problem, but was wondering if anyone here  
had  
run into this or has an idea on where to look. I can’t find anything via  
Google or on the Trac.

My environment:

Ruby version 1.8.6 (i386-mswin32)  
RubyGems version 0.9.2  
Rails version 1.2.0  
Active Record version 1.14.4  
Action Pack version 1.12.5  
Action Web Service version 1.1.6  
Action Mailer version 1.2.5  
Active Support version 1.3.1  
Edge Rails revision 6494  
Application root C:/Development/AdminPortal  
Environment development  
Database adapter mysql

Thanks.

Jason
