Class: Grape::Validations::Validators::MultipleParamsBase
- Defined in:
- lib/grape/validations/validators/multiple_params_base.rb
Direct Known Subclasses
AllOrNoneOfValidator, AtLeastOneOfValidator, ExactlyOneOfValidator, MutualExclusionValidator
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
convert_to_short_name, #fail_fast?, inherited, #initialize, #message, #options_key?, #validate
Constructor Details
This class inherits a constructor from Grape::Validations::Validators::Base
Instance Method Details
#validate!(params) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/grape/validations/validators/multiple_params_base.rb', line 7 def validate!(params) attributes = MultipleAttributesIterator.new(self, @scope, params) array_errors = [] attributes.each do |resource_params, skip_value| next if skip_value begin validate_params!(resource_params) rescue Grape::Exceptions::Validation => e array_errors << e end end raise Grape::Exceptions::ValidationArrayErrors.new(array_errors) if array_errors.any? end |