Class: ErrorsController
- Defined in:
- app/controllers/errors_controller.rb
Overview
app/controllers/errors_controller.rb We want to inherit ActionController::Base here, not ApplicationController because we just want a simple, fast response with no extra checks for CSRF,authentication, layouts or the ilk. Just say, no, go away!
Instance Method Summary collapse
- #not_found ⇒ Object abstract
- #preflight ⇒ Object abstract
Instance Method Details
#not_found ⇒ Object
This method is abstract.
Quietly return a 410 Gone and go away, dont report this
10 11 12 13 14 15 |
# File 'app/controllers/errors_controller.rb', line 10 def not_found if defined?(NewRelic) && defined?(NewRelic::Agent) NewRelic::Agent.ignore_transaction end head :gone # 410 Gone is used here to indicate that the resource has been intentionally and permanently removed, and clients should not expect it to be available again. This is stronger than the standard 404 Not Found, which is used when the resource may be available in the future. end |
#preflight ⇒ Object
This method is abstract.
Quietly return 204 for OPTIONS (preflight)
18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/errors_controller.rb', line 18 def preflight if defined?(NewRelic) && defined?(NewRelic::Agent) NewRelic::Agent.ignore_transaction end # Add CORS headers if you normally set them (optional) # response.set_header('Access-Control-Allow-Origin', '*') # response.set_header('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE, OPTIONS') # response.set_header('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-Requested-With') head :no_content end |