Exception: Grape::Exceptions::Validation
- Defined in:
- lib/grape/exceptions/validation.rb
Constant Summary
Constants inherited from Base
Base::BASE_ATTRIBUTES_KEY, Base::BASE_MESSAGES_KEY, Base::FALLBACK_LOCALE
Instance Attribute Summary collapse
-
#message_key ⇒ Object
Returns the value of attribute message_key.
-
#params ⇒ Object
Returns the value of attribute params.
Attributes inherited from Base
Instance Method Summary collapse
-
#as_json(*_args) ⇒ Object
Remove all the unnecessary stuff from Grape::Exceptions::Base like status and headers when converting a validation error to json or string.
-
#initialize(params:, message: nil, **args) ⇒ Validation
constructor
A new instance of Validation.
Methods inherited from Base
Constructor Details
#initialize(params:, message: nil, **args) ⇒ Validation
Returns a new instance of Validation.
10 11 12 13 14 15 16 17 |
# File 'lib/grape/exceptions/validation.rb', line 10 def initialize(params:, message: nil, **args) @params = params if @message_key = if .is_a?(Symbol) args[:message] = () end super(**args) end |
Instance Attribute Details
#message_key ⇒ Object
Returns the value of attribute message_key.
8 9 10 |
# File 'lib/grape/exceptions/validation.rb', line 8 def @message_key end |
#params ⇒ Object
Returns the value of attribute params.
8 9 10 |
# File 'lib/grape/exceptions/validation.rb', line 8 def params @params end |
Instance Method Details
#as_json(*_args) ⇒ Object
Remove all the unnecessary stuff from Grape::Exceptions::Base like status and headers when converting a validation error to json or string
21 22 23 |
# File 'lib/grape/exceptions/validation.rb', line 21 def as_json(*_args) to_s end |