# How to correctly render a .rxml template for respond\_to?

**URL:** <https://www.ruby-forum.com/t/how-to-correctly-render-a-rxml-template-for-respond-to/75672>\
**Category:** Rails\
**Created:** [November 12, 2006, 6:04am UTC](https://www.ruby-forum.com/t/how-to-correctly-render-a-rxml-template-for-respond-to/75672 "2006-11-12T06:04:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![edmz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/898d66/32.png) [@edmz](https://www.ruby-forum.com/u/edmz)\
**Post date:** [November 12, 2006, 6:04am UTC](https://www.ruby-forum.com/t/how-to-correctly-render-a-rxml-template-for-respond-to/75672/1 "2006-11-12T06:04:57Z")

</div>

'm using resources.

I have two templates for the show action (show.rhtml and show.rxml).

If I specify the format in the URL (/posts/1.xml) the show.rxml  
templates gets rendered with the current layout. Problem would be solved  
if I could disable the layout for a specific format, but seems that its  
not possible.

Any ideas ?

My app needs more than just:

format.xml { render :xml =\> @post.to\_xml }

thats why I need to have a show.rxml template.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![edmz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/898d66/32.png) [@edmz](https://www.ruby-forum.com/u/edmz)\
**Post date:** [December 31, 2006, 5:28pm UTC](https://www.ruby-forum.com/t/how-to-correctly-render-a-rxml-template-for-respond-to/75672/2 "2006-12-31T17:28:43Z")

</div>

Hi Eduardo,

I am having the same problem - did you find a solution to this?

Ingo

Eduardo D. wrote:

> 'm using resources.
> 
> I have two templates for the show action (show.rhtml and show.rxml).
> 
> If I specify the format in the URL (/posts/1.xml) the show.rxml  
> templates gets rendered with the current layout. Problem would be solved  
> if I could disable the layout for a specific format, but seems that its  
> not possible.
> 
> Any ideas ?
> 
> My app needs more than just:
> 
> format.xml { render :xml =\> @post.to\_xml }
> 
> thats why I need to have a show.rxml template.
> 
> Thanks in advance.

---

<div class="post-metadata">

**Author:** ![edmz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/898d66/32.png) [@edmz](https://www.ruby-forum.com/u/edmz)\
**Post date:** [December 31, 2006, 8:29pm UTC](https://www.ruby-forum.com/t/how-to-correctly-render-a-rxml-template-for-respond-to/75672/3 "2006-12-31T20:29:23Z")

</div>

On Nov 12, 12:04 am, Eduardo D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> 'm using resources.
> 
> I have two templates for the show action (show.rhtml and show.rxml).
> 
> If I specify the format in the URL (/posts/1.xml) the show.rxml  
> templates gets rendered with the current layout. Problem would be solved  
> if I could disable the layout for a specific format, but seems that its  
> not possible.

how about?

def show

# show method contents here

respond\_to do |format|  
format.html  
format.xml { render :action =\> “show.rxml”, :layout =\> false }  
end  
end

Best,

-r

> –  
> Posted viahttp://www.ruby-forum.com/.

–  
Ryan R.  
[http://raaum.org](http://raaum.org)  
[http://rails.raaum.org](http://rails.raaum.org) – Rails docs  
[http://locomotive.raaum.org](http://locomotive.raaum.org) – Self contained Rails for Mac OS X
