Skip to content

Instantly share code, notes, and snippets.

@evanwalsh
Created December 11, 2008 02:50
Show Gist options
  • Save evanwalsh/34588 to your computer and use it in GitHub Desktop.
Save evanwalsh/34588 to your computer and use it in GitHub Desktop.
# Put this in routes.rb at the very bottom (right before end)
map.error '*path', :controller => 'application', :action => 'rescue_404'
# Put this in application.rb
rescue_from ActiveRecord::RecordNotFound, ActionController::UnknownAction, :with => :rescue_404
def rescue_404
render :template => "errors/404", :layout => "application", :status => "404"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment