Return custom http responses from a controller?

Is it possible to have a response to the browser triggered prematurely
in a controller? like before rails does all it’s internal processing?

also if so can I change the content-type for the response?

thanks

Aaron S. wrote:

Is it possible to have a response to the browser triggered prematurely
in a controller? like before rails does all it’s internal processing?

also if so can I change the content-type for the response?

thanks

Also, besides the content-type, how can I supply a custom response body?

On 6/29/07, Aaron S. [email protected] wrote:

Aaron S. wrote:

Is it possible to have a response to the browser triggered prematurely
in a controller? like before rails does all it’s internal processing?

also if so can I change the content-type for the response?

thanks

Also, besides the content-type, how can I supply a custom response body?

render is what supplies the response body. There are just more ways
to render then you are aware of. render :text => ‘test’, render
:file =>file, render_xml, etc…

To set headers do this before rendering:

headers[“Content-Type”] = ‘mycontenttype’

Chris

perfect. thanks.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs