Class: Grape::Validations::MutualExclusionValidator
- Inherits:
-
MultipleParamsBase
- Object
- Base
- MultipleParamsBase
- Grape::Validations::MutualExclusionValidator
- Defined in:
- lib/grape/validations/validators/mutual_exclusion.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from MultipleParamsBase
Methods inherited from Base
convert_to_short_name, #fail_fast?, inherited, #initialize, #message, #options_key?, #validate, #validate!
Constructor Details
This class inherits a constructor from Grape::Validations::Base
Instance Method Details
#validate_params!(params) ⇒ Object
8 9 10 11 12 |
# File 'lib/grape/validations/validators/mutual_exclusion.rb', line 8 def validate_params!(params) keys = keys_in_common(params) return if keys.length <= 1 raise Grape::Exceptions::Validation.new(params: keys, message: (:mutual_exclusion)) end |