File tree 2 files changed +5
-6
lines changed
2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -191,8 +191,7 @@ def params(params)
191
191
params = @parent . params ( params ) if @parent
192
192
if @element
193
193
params = if params . is_a? ( Array )
194
- # we can get nested arrays as result
195
- # it used for calculating parent array indicies for error messages
194
+ # used for calculating parent array indices for error messages
196
195
params . map { |el | el [ @element ] || { } }
197
196
elsif params . is_a? ( Hash )
198
197
params [ @element ] || { }
Original file line number Diff line number Diff line change @@ -34,18 +34,18 @@ def validate(request)
34
34
# @raise [Grape::Exceptions::Validation] if validation failed
35
35
# @return [void]
36
36
def validate! ( params )
37
- attributes = AttributesIterator . new ( self , @scope , params )
38
- array_errors = [ ]
37
+ attributes = AttributesIterator . new ( self , @scope , params )
38
+ array_errors = [ ]
39
39
attributes . each do |resource_params , attr_name , inside_array |
40
40
next unless @required || ( resource_params . respond_to? ( :key? ) && resource_params . key? ( attr_name ) )
41
41
42
42
begin
43
43
validate_param! ( attr_name , resource_params )
44
- rescue Grape ::Exceptions ::Validation => error
44
+ rescue Grape ::Exceptions ::Validation => e
45
45
raise error unless inside_array
46
46
# we collect errors inside array because
47
47
# there may be more than one error per field
48
- array_errors << error
48
+ array_errors << e
49
49
end
50
50
end
51
51
You can’t perform that action at this time.
0 commit comments