Class: Grape::Validations::AtLeastOneOfValidator

Inherits:
MultipleParamsBase show all
Defined in:
lib/grape/validations/validators/at_least_one_of.rb

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods inherited from MultipleParamsBase

#validate!

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
# File 'lib/grape/validations/validators/at_least_one_of.rb', line 8

def validate_params!(params)
  return unless keys_in_common(params).empty?
  raise Grape::Exceptions::Validation.new(params: all_keys, message: message(:at_least_one))
end