Created
September 14, 2012 07:37
-
-
Save bansalakhil/3720549 to your computer and use it in GitHub Desktop.
Custom error pages in Rails3.2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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