# Render, respond\_to, and rxml files

**URL:** <https://www.ruby-forum.com/t/render-respond-to-and-rxml-files/119881>\
**Category:** Rails\
**Created:** [November 11, 2007, 9:40pm UTC](https://www.ruby-forum.com/t/render-respond-to-and-rxml-files/119881 "2007-11-11T21:40:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgreenly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85f322/32.png) [@mgreenly](https://www.ruby-forum.com/u/mgreenly)\
**Post date:** [November 11, 2007, 9:40pm UTC](https://www.ruby-forum.com/t/render-respond-to-and-rxml-files/119881/1 "2007-11-11T21:40:33Z")

</div>

So, I need to do some custom rendering of data, mainly to filter out  
what is generated. I could put this in the model by overriding the  
to\_xml for my models, but that’s something of a hack to me.

I made a file called “index.rxml” in views/machines, and I’ve tried  
things like this in the machines\_controller:

format.html  
format.xml { render :layout =\> false }

However, this causes it to render index.rhtml instead. So, I tried  
this:

format.xml { render :action =\> “index.rxml”, :layout =\> false }

and this works. But it also seems like a hack: why should I have to  
tell render the filename, and why should I constantly have to specify  
:layout =\> false? Is there a DRY way to do this that isn’t even a  
little bit of a hack? 🙂

–Michael
