fanforce-validations 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/fanforce/validations/validations.rb +4 -2
- data/lib/fanforce/validations/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NmQ0MmU3YjhiZjI2MjBiMzcwODZmNjk3YzNjYzE5NzM4Mzg0ZGRkYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGVmNjNlZGNkYWI2YWJlZDExZTRkZTFhZmQ1ODU0ZWI2MmExNDQ0Ng==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODFmNDQ0ZjQwZDljMWNmZDMwY2Q3NWFjNWE3NzI1NDcwZTQ5NTdhYjg3MWJh
|
10
|
+
Mjg2YmYyZWRlMDZhOWJiODZkM2EzYjkzMDEyYjhlMTlmZmUzOWE0NDg3OWIw
|
11
|
+
MmYxMTY3MGNiZTQ5YWQ0YmVmNDhlYWRlNjUzMDViYWYxYmMzMDY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzA2NDY5N2Q1NDhlYWI0MzU5ZWRlOWMzYTZjZTJlYjg2OGYxM2VlMGMyYTBh
|
14
|
+
ZDFjNWQ3MzA1ZTRhNTlhZjE3ZjliNDhiNTk3MjYyOThlMjgyZDc1ODkyMWVk
|
15
|
+
NGJlMTYwYjgxOGU5NTcyN2IyNzBmYjJiYzU4ODMwM2RhZjBkMmE=
|
@@ -33,7 +33,8 @@ module Fanforce::Validations
|
|
33
33
|
end
|
34
34
|
return true if invalid_fields.size == 0
|
35
35
|
|
36
|
-
|
36
|
+
error_code = (invalid_fields.size == 1) ? :missing_field : :missing_fields
|
37
|
+
errors = invalid_fields.inject([]) {|result, f| result << format_validation_error(opts, f, error_code) }
|
37
38
|
raise_validation_errors(opts, errors, Fanforce::Error::BadRequest)
|
38
39
|
end
|
39
40
|
alias :validates_presence_of :validates_presence_of_all
|
@@ -51,7 +52,8 @@ module Fanforce::Validations
|
|
51
52
|
end
|
52
53
|
return true if invalid_fields.size < fields_to_validate.size
|
53
54
|
|
54
|
-
|
55
|
+
error_code = (invalid_fields.size == 1) ? :missing_field : :missing_field_from_list
|
56
|
+
errors = [format_validation_error(opts, invalid_fields, error_code)]
|
55
57
|
raise_validation_errors(opts, errors, Fanforce::Error::BadRequest)
|
56
58
|
end
|
57
59
|
|