Class: Grape::Validations::Validators::MultipleParamsBase

Inherits:
Base
  • Object
show all
Defined in:
lib/grape/validations/validators/multiple_params_base.rb

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods inherited from Base

#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
# 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|
    validate_params!(resource_params)
  rescue Grape::Exceptions::Validation => e
    array_errors << e
  end

  raise Grape::Exceptions::ValidationArrayErrors.new(array_errors) if array_errors.any?
end