How to correctly render a .rxml template for respond_to?

'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.

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.

On Nov 12, 12:04 am, Eduardo D. [email protected]
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://rails.raaum.org – Rails docs
http://locomotive.raaum.org – Self contained Rails for Mac OS X