Exception: ActionController::MethodNotAllowed
- Inherits:
-
ActionControllerError
- Object
- StandardError
- ActionControllerError
- ActionController::MethodNotAllowed
- Defined in:
- lib/action_controller/base.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Attribute Summary collapse
-
#allowed_methods ⇒ Object
readonly
Returns the value of attribute allowed_methods.
Instance Method Summary collapse
- #allowed_methods_header ⇒ Object
- #handle_response!(response) ⇒ Object
-
#initialize(*allowed_methods) ⇒ MethodNotAllowed
constructor
A new instance of MethodNotAllowed.
Constructor Details
#initialize(*allowed_methods) ⇒ MethodNotAllowed
Returns a new instance of MethodNotAllowed.
35 36 37 38 |
# File 'lib/action_controller/base.rb', line 35 def initialize(*allowed_methods) super("Only #{allowed_methods.to_sentence} requests are allowed.") @allowed_methods = allowed_methods end |
Instance Attribute Details
#allowed_methods ⇒ Object (readonly)
Returns the value of attribute allowed_methods.
33 34 35 |
# File 'lib/action_controller/base.rb', line 33 def allowed_methods @allowed_methods end |
Instance Method Details
#allowed_methods_header ⇒ Object
40 41 42 |
# File 'lib/action_controller/base.rb', line 40 def allowed_methods_header allowed_methods.map { |method_symbol| method_symbol.to_s.upcase } * ', ' end |
#handle_response!(response) ⇒ Object
44 45 46 |
# File 'lib/action_controller/base.rb', line 44 def handle_response!(response) response.headers['Allow'] ||= allowed_methods_header end |