How do I programmatically send a 404 error

I want to programmatically under certain conditions return a 404 (page
not found) error to the browser. How can I do this from my controller?

I’m assuming I need to set a header on the reponse obect. However I
can’t figure out what the header name is.

thanks, scott.

Greetings Scott

Yep, you’re right

       response.headers["Status"] = "404"

cheers,
Jodi

Is something preventing…

render :nothing => true, :status => 404

…from being apropos?

Edward F. wrote:

Is something preventing…

render :nothing => true, :status => 404

…from being apropos?

ahh. Much, more,elegant!

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