# Render (:xml=\>:model) based transformation

**URL:** <https://www.ruby-forum.com/t/render-xml-model-based-transformation/171291>\
**Category:** Rails\
**Created:** [June 30, 2009, 4:54am UTC](https://www.ruby-forum.com/t/render-xml-model-based-transformation/171291 "2009-06-30T04:54:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flash](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f475e1/32.png) [@flash](https://www.ruby-forum.com/u/flash)\
**Post date:** [June 30, 2009, 4:54am UTC](https://www.ruby-forum.com/t/render-xml-model-based-transformation/171291/1 "2009-06-30T04:54:30Z")

</div>

Hi,

Trying to get my head around how Rails works. I am trying to generate  
an xml representation of a model’s list view. It works well when I try  
to simply use

format.xml { render :xml=\>@models }

But I need to change the name of the elements slightly. Tried to use  
an action.rxml template using the following syntax

format.xml { render :xml=\>@models, :template=\>‘mymodels/action’ }

and it seems to only generate a blank response. If I enter some  
garbage in the template it gives me an error. So I know the template  
is being picked up. Is there an easy way to debug why its generating  
an empty response?

Another question I guess would be, is there a better way to transform  
the response so that it generates what I want rather than the  
defaults? render() seems to take a block. But I don’t know how to use  
that.

Thanks!
