Class: Grape::Validations::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

convert_to_short_name, #fail_fast?, inherited, #initialize, #message, #options_key?, #validate

Constructor Details

This class inherits a constructor from Grape::Validations::Base

Instance Method Details

#validate!(params) ⇒ Object


6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/grape/validations/validators/multiple_params_base.rb', line 6

def validate!(params)
  attributes = MultipleAttributesIterator.new(self, @scope, params)
  array_errors = []

  attributes.each do |resource_params|
    begin
      validate_params!(resource_params)
    rescue Grape::Exceptions::Validation => e
      array_errors << e
    end
  end

  raise Grape::Exceptions::ValidationArrayErrors, array_errors if array_errors.any?
end