This project is archived and is in readonly mode.

#4529 ✓committed
VirtualFunction

ActiveResource does not serialize XML correctly

Reported by VirtualFunction | May 4th, 2010 @ 07:53 AM | in 3.0.2

Assuming I have

class RemoteArticle < ActiveResource::Base
  self.element_name = 'article'
end

RemoteArticle.new.to_xml

now results in:

<?xml version="1.0" encoding="UTF-8"?>
<remote-article>
</remote-article>

the node tag name should really be article, not remote-article.

I'm hacking my way round this by making the encode method call "to_xml :root => self.class.element_name" as I see methods like update/create call encode rather than to_xml/to_json however this is not a real fix.

I'm using Rails 3.0 trunk/master from about 2 hours ago. I don't seem to recall this being an issue in beta 1 or 2.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>