views:

176

answers:

1

I'm working with ActiveResource a lot so my service models are only using XML. Thus, I have no need for a respond_to block, I literally just render :xml => @model

I can't however figure out how to render a 404 header using this. I've had to resort to respond_to, which I think adds a few unnecessary method calls. Here's what I'm using:

respond_to do |format|
  if (record_found)
    render :xml => @some_record
  else
    format.xml{ head :not_found }
  end
end

but I just want something like render :xml => head :not_found which doesn't work. Can anyone tell me the proper syntax?

A: 

Have you tried:

render {:xml => "Record not found", :status => :not_found }
KandadaBoggu
you're getting lots of points from my questions!! Thanks, I didn't realize a straight string would work
brad