validation_profiler 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e73f7df9dd6ae5d0a38f0b5289eae7fcf5c5169
|
4
|
+
data.tar.gz: dc60c99963b059bbdbe24b904f3817e4ecb56661
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2755117a1870bbf2869486555eaaf05cb5f3ef03fe9727e060248d37afdc36224d380d00ae2a1e0360c19b590c2d1f0be3030883bb842fedecbba820290a1903
|
7
|
+
data.tar.gz: c7c33f53245c9514bd070bbee7d16002e8bb52741f9562561535659b9199dd17e1341504069adf8f566e678beb85fd2e7c134d44db81df8e157e6fc02ac3c5cd
|
@@ -2,10 +2,6 @@ module ValidationProfiler
|
|
2
2
|
module Rules
|
3
3
|
class ChildValidationRule < ValidationProfiler::Rules::ValidationRule
|
4
4
|
|
5
|
-
def initialize
|
6
|
-
@validation_manager = ValidationProfiler::Manager.new
|
7
|
-
end
|
8
|
-
|
9
5
|
def error_message(field, attributes = {}, parent = nil)
|
10
6
|
|
11
7
|
field_name = field.to_s
|
@@ -45,7 +41,7 @@ module ValidationProfiler
|
|
45
41
|
parent_field = "#{parent.to_s}.#{field.to_s}"
|
46
42
|
end
|
47
43
|
|
48
|
-
return
|
44
|
+
return ValidationProfiler::Manager.new.validate(field_value, profile, parent_field)
|
49
45
|
|
50
46
|
end
|
51
47
|
|
data/lib/validation_profiler.rb
CHANGED
@@ -52,8 +52,9 @@ module ValidationProfiler
|
|
52
52
|
rule = ValidationProfiler::Rules::Manager.instance.get_rule(r[:name])
|
53
53
|
outcome = rule.validate(obj, r[:field], r[:attributes], parent)
|
54
54
|
|
55
|
-
if outcome.is_a?(ValidationProfiler::ManagerResult)
|
56
|
-
result = outcome
|
55
|
+
if outcome.is_a?(ValidationProfiler::ManagerResult) && !outcome.outcome
|
56
|
+
result.errors = result.errors + outcome.errors
|
57
|
+
result.outcome = false
|
57
58
|
elsif !outcome
|
58
59
|
result.outcome = false
|
59
60
|
result.errors.push({ field: r[:field], message: rule.error_message(r[:field], r[:attributes], parent) })
|