aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authorYuki Nishijima <mail@yukinishijima.net>2014-11-23 13:30:04 -0800
committerYuki Nishijima <mail@yukinishijima.net>2014-11-28 09:39:27 -0800
commitcbcec99fdbd635bba77bcc94c8622369690bdb4a (patch)
tree6776db2f2b38000156f1f0030e0b22e074aadf9b /guides/source
parentf25ad07f5ade46eb978fa82658463232d0247c65 (diff)
downloadrails-cbcec99fdbd635bba77bcc94c8622369690bdb4a.tar.gz
rails-cbcec99fdbd635bba77bcc94c8622369690bdb4a.tar.bz2
rails-cbcec99fdbd635bba77bcc94c8622369690bdb4a.zip
Remove custom errors page section from the guides
This pattern is too problematic and introduces a lot of edge cases: * On 4.2, the issue https://github.com/rails/rails/issues/15124 is back again. * needs to define each action for each http status otherwise the router raises ActionController::RoutingError (No route matches). * If the router has `match "/*username",...` and some action is missing, Rails will pick up the "match" and try to do its job. * encourages people to copy & paste programming. Not DRY. [ci skip]
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/action_controller_overview.md59
1 files changed, 1 insertions, 58 deletions
diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md
index 1ca0d9ed55..4e36a62583 100644
--- a/guides/source/action_controller_overview.md
+++ b/guides/source/action_controller_overview.md
@@ -1164,67 +1164,10 @@ class ClientsController < ApplicationController
end
```
-WARNING: You shouldn't do `rescue_from Exception` or `rescue_from StandardError` unless you have a particular reason as it will cause serious side-effects (e.g. you won't be able to see exception details and tracebacks during development). If you would like to dynamically generate error pages, see [Custom errors page](#custom-errors-page).
+WARNING: You shouldn't do `rescue_from Exception` or `rescue_from StandardError` unless you have a particular reason as it will cause serious side-effects (e.g. you won't be able to see exception details and tracebacks during development).
NOTE: Certain exceptions are only rescuable from the `ApplicationController` class, as they are raised before the controller gets initialized and the action gets executed. See Pratik Naik's [article](http://m.onkey.org/2008/7/20/rescue-from-dispatching) on the subject for more information.
-
-### Custom errors page
-
-You can customize the layout of your error handling using controllers and views.
-First define your app own routes to display the errors page.
-
-* `config/application.rb`
-
- ```ruby
- config.exceptions_app = self.routes
- ```
-
-* `config/routes.rb`
-
- ```ruby
- match '/404', via: :all, to: 'errors#not_found'
- match '/422', via: :all, to: 'errors#unprocessable_entity'
- match '/500', via: :all, to: 'errors#server_error'
- ```
-
-Create the controller and views.
-
-* `app/controllers/errors_controller.rb`
-
- ```ruby
- class ErrorsController < ActionController::Base
- layout 'error'
-
- def not_found
- render status: :not_found
- end
-
- def unprocessable_entity
- render status: :unprocessable_entity
- end
-
- def server_error
- render status: :server_error
- end
- end
- ```
-
-* `app/views`
-
- ```
- errors/
- not_found.html.erb
- unprocessable_entity.html.erb
- server_error.html.erb
- layouts/
- error.html.erb
- ```
-
-Do not forget to set the correct status code on the controller as shown before.
-
-WARNING: You should avoid using the database or any complex operations because the user is already on the error page. Generating another error while on an error page could cause issues like presenting an empty page for the users.
-
Force HTTPS protocol
--------------------