12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/motion_data_wrapper/model/validations.rb', line 12
def errors
errors = {}
valid? do |valid, error|
next if error.nil?
if error.code == NSValidationMultipleErrorsError
errs = error.userInfo[NSDetailedErrorsKey]
errs.each do |nserr|
property = nserr.userInfo['NSValidationErrorKey']
errors[property] = message_for_error_code(nserr.code, property)
end
else
property = error.userInfo['NSValidationErrorKey']
errors[property] = message_for_error_code(error.code, property)
end
end
errors
end
|