Skip to content

Instantly share code, notes, and snippets.

@bansalakhil
Created September 14, 2012 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bansalakhil/3720549 to your computer and use it in GitHub Desktop.
Save bansalakhil/3720549 to your computer and use it in GitHub Desktop.
Custom error pages in Rails3.2
# In rails 3.2, it's creating custom error pages is much more easier:
#
# Add this to config/application.rb:
config.exceptions_app = self.routes
# That causes errors to be routed via the router. Then you just add to config/routes.rb:
match "/404", :to => "errors#not_found"
# Now create your ErrorsController#not_found
# You can always access the original exception in the controller at env["action_dispatch.exception"];
# You won’t be able to see your custom exceptions in development unless you set config.consider_all_requests_local to false in your config/environments/development.rb.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment