Class: Qa::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Qa::ApplicationController
- Defined in:
- app/controllers/qa/application_controller.rb
Class Method Summary collapse
-
.cors_allow_origin_header(response) ⇒ Object
Add cors headers to the passed in http response if cors_headers are enabled.
Instance Method Summary collapse
-
#options ⇒ Object
Process the OPTIONS method for all routes.
Class Method Details
.cors_allow_origin_header(response) ⇒ Object
Note:
The qa.rb initializer is copied to /config/initializers/qa.rb and can be modified to enable/disable cors headers.
Note:
Add cors headers to the passed in http response if cors_headers are enabled. Called by all controller actions to adjust the response.
24 25 26 |
# File 'app/controllers/qa/application_controller.rb', line 24 def self.cors_allow_origin_header(response) response.headers['Access-Control-Allow-Origin'] = '*' if Qa.config.cors_headers? end |
Instance Method Details
#options ⇒ Object
Note:
Process the OPTIONS method for all routes
8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/qa/application_controller.rb', line 8 def unless Qa.config.cors_headers? head :not_implemented return end response.headers['Access-Control-Allow-Origin'] = '*' response.headers['Access-Control-Allow-Methods'] = 'GET, OPTIONS' head :no_content end |