Hoopla! » Rails: Custom 404 Pages

sasha said: there is another more generic way that will catch all the errors, you can inspect the exception to route to the right view, and possibly log the trace: in application.rb
def rescue_action_in_public(exception)
  # do something based on exception
  message = exception.backtrace.join("\n") unless exception
  render :file => "#{RAILS_ROOT}/public/404.html", :layout => false, :status => 404
end

def local_request?
  false
end
thanks for the CSV tip. doc is atrocious

覆寫「rescue_action_in_public」來處理 global 的 exception。