How do I programmatically send a 404 error


#1

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.


#2

Greetings Scott

Yep, you’re right

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

cheers,
Jodi


#3

Is something preventing…

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

…from being apropos?


#4

Edward F. wrote:

Is something preventing…

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

…from being apropos?

ahh. Much, more,elegant!