# Error message when using .to\_xml

**URL:** <https://www.ruby-forum.com/t/error-message-when-using-to-xml/133330>\
**Category:** Rails\
**Created:** [March 30, 2008, 8:23am UTC](https://www.ruby-forum.com/t/error-message-when-using-to-xml/133330 "2008-03-30T08:23:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ecae2f/32.png) [@ron](https://www.ruby-forum.com/u/ron)\
**Post date:** [March 30, 2008, 8:23am UTC](https://www.ruby-forum.com/t/error-message-when-using-to-xml/133330/1 "2008-03-30T08:23:36Z")

</div>

Hi,

I’m trying to generate an xml feed. I have an array of posts stored  
in an instance variable for this particular action.

I am trying to define the response to an xml request by:

respond\_to do |a|  
a.xml {render :xml, @posts.to\_xml}  
a.rss {render :action=\>‘rss.rxml’, :layout=\> false}  
a…atom {render :action=\> ‘atom.rxml’, :layout=\> false}  
end  
This is under the list action, btw.

When I request that URL, I get:

private method `sub’ called for :xml:Symbol

Any thoughts on what I’m missing?

Thanks,

Ron

---

<div class="post-metadata">

**Author:** ![ron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ecae2f/32.png) [@ron](https://www.ruby-forum.com/u/ron)\
**Post date:** [March 30, 2008, 11:09am UTC](https://www.ruby-forum.com/t/error-message-when-using-to-xml/133330/2 "2008-03-30T11:09:48Z")

</div>

On Mar 30, 7:22 am, Ron [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> a..atom {render :action=> 'atom.rxml', :layout=> false}
> 
> ```
> 
> end  
> that should be render :xml =\> @posts.xml

Fred
