views:

501

answers:

3

What's the preferred way to issue a 404 response from a rails controller action?

+3  A: 

This seems good...

render :file => "#{RAILS_ROOT}/public/404.html",  :status => 404
Jason Punyon
+4  A: 

Reference:

render :file => '/path/to/some/filenotfound.rhtml', 
                status => 404, :layout => true
tvanfosson
This is a little nicer...
Jason Punyon
A: 

In the ApplicationController define a method like:

def render_404
  render :file => "#{RAILS_ROOT}/public/404.html",  :status => 404
end
huacnlee