lite-validators 1.7.1 → 1.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/lite/validators/reference_validator.rb +4 -3
- data/lib/lite/validators/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d3f051d098209d84823656f14c23f4537aa26b0f554328752ede05dd12f8fe2
|
4
|
+
data.tar.gz: 138ce3bcc2159ab4e53023e1184e0012be5ec0941cb50f2d906f3b3f0261f1fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aba646abaf9c698367acc9e2f798358e109cec13fb7442c6cd8e79578c46a9a3210fefa458f71e91990dc9cc96a54af239696f42563d1199eaa1351d7c11c656
|
7
|
+
data.tar.gz: 0b5479cfb1066309c1854e4359396528b7e8a7004bae4de5beabca38db4e7824e44028919c30144d3cc00fb1f34538179bd47bd0b924d6701845978b783e30a1
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.7.2] - 2022-03-18
|
10
|
+
### Changed
|
11
|
+
- Check associated object is valid to reference validator
|
12
|
+
|
9
13
|
## [1.7.1] - 2022-03-17
|
10
14
|
### Changed
|
11
15
|
- Added polymorphic support to reference validator
|
data/Gemfile.lock
CHANGED
@@ -21,10 +21,11 @@ class ReferenceValidator < BaseValidator
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def valid_object?
|
24
|
-
|
25
|
-
|
24
|
+
association_type = options[:association] || attribute.to_s.chomp('_id')
|
25
|
+
association_object = record.send(association_type)
|
26
|
+
return true if association_object.present? && association_object.valid?
|
26
27
|
|
27
|
-
record.errors.add(
|
28
|
+
record.errors.add(association_type, *error_message)
|
28
29
|
end
|
29
30
|
|
30
31
|
def valid_type?
|