# Why to\_xml on ActiveResource does not work well?

**URL:** <https://www.ruby-forum.com/t/why-to-xml-on-activeresource-does-not-work-well/175156>\
**Category:** Rails\
**Created:** [September 9, 2009, 6:23am UTC](https://www.ruby-forum.com/t/why-to-xml-on-activeresource-does-not-work-well/175156 "2009-09-09T06:23:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chamnap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/779978/32.png) [@chamnap](https://www.ruby-forum.com/u/chamnap)\
**Post date:** [September 9, 2009, 6:23am UTC](https://www.ruby-forum.com/t/why-to-xml-on-activeresource-does-not-work-well/175156/1 "2009-09-09T06:23:58Z")

</div>

I have several ActiveResource model in my project. There was so  
strange to me when I called to\_xml on my ActiveResource. The options  
that I passed to to\_xml like :only and :except doesn’t work at all. On  
ActiveRecord, it works really well. Anyone knows?

class Node \< ActiveResource::Base  
self.site = NODE\_SERVER  
end

# node has uuid, name, type attributes

node = Node.find(“3333”)  
node.to\_xml(:only =\> [:uuid])

# after here, i still get all attributes
\<?xml version=\"1.0\" encoding=\"UTF-8\"?\>\n\n \<uuid type=

“integer”\>0\n AAAA\n \n
