Why is my rxml view being wrapped by the rhtml template in v

Why is my rxml view being wrapped by the rhtml template in views/
layouts?

I was experimenting with REST, I had a nice little test program with
one table: ‘resources’. Here’s what the show method looks like:

def show
@resource = Resource.find(params[:id])
respond_to do |accepts|
accepts.html
accepts.xml
end
end

I have a show.rhtml and show.rxml views.

I could see the html doing this:

curl -H ‘Accept: application/xml’ http://localhost:3000/resource/show/1

and the xml doing this:

curl -H ‘Accept: application/xml’ http://localhost:3000/resource/show/1

And it worked … then I must have done something wrong and went to
dinner. Now I’m back and every request I make asking for xml runs
layouts/resource.layout. This causes the effect of having my xml
output wrapped by the html generated by the standard layout template.

Thanks for any ideas!

need a:

render :layout => false

in the controller to stop layout generation

On Jul 20, 2006, at 4:53 AM, Brez! !! wrote:

need a:

render :layout => false

in the controller to stop layout generation

My controller action looks like this:

def show
@resource = Resource.find(params[:id])
respond_to do |accepts|
accepts.html
accepts.xml
end
end

It was working just fine without render :layout => false – then it
wasn’t?? Adding your suggestion like this works however:

def show
@resource = Resource.find(params[:id])
respond_to do |accepts|
accepts.html
accepts.xml { render :layout => false }
end
end

I don’t see this needed in any of the examples I read about (example:
http://media.pragprog.com/titles/rails2/Rest.pdf) – and now I think
I must have been hallucinating when I thought it was working
before …??

Anyways, Thanks for the suggestion!