Ticket #5845 - to_xml patch

I was wondering if I could get someone to have a look at this ticket: http://dev.rubyonrails.org/ticket/5845

It's a trivial patch, and I have included a unit test. I also ran all the other active record tests, and everything passes after the change. It's just a small thing, but it's something that I'm using right now, and having the patch as part of trunk would be helpful.

Thanks guys!