Topic: to_xml caching/repitition problem
I am developing a REST API which uses the to_xml-method a lot. For one model, the resulting XML seems to get cached and everytime the method is called, new XML is appended to the previous result. The result is invalid XML like this:
<?xml version="1.0"?>
<projects type="array">
<project> ... </project>
</projects>
<?xml version="1.0"?> <!-- repetition starts here -->
<projects type="array">
<project> ... </project>
</projects>
<?xml version="1.0"?> <!-- another repetition -->
<projects type="array"> ...
So, everytime the method is called, another repetition is padded to the end of the result.
The problem does not occur:
- if config.cache_classes = false in the environment.rb
(running in production mode with config.cache_classes = false is not an option unfortunately)
- for other models than Project
- if to_xml is called on a single Project-instance instead of an array.
- to_json works fine as well
Does anybody have any clue on what could be wrong or how it could be fixed? I have looked for the cause for sow long now my head is going to explode... If you have had a similar problem I would really like to hear from you!
Thanks,
Willem