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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cbc212144b10828145cc04c3117cd994c6b5b5ffd6539b8e9cb08d45e05b15b
4
- data.tar.gz: 31deca154872899b7faa80838416c68c1830d97982c948301dc373238bc1a3b1
3
+ metadata.gz: 0d3f051d098209d84823656f14c23f4537aa26b0f554328752ede05dd12f8fe2
4
+ data.tar.gz: 138ce3bcc2159ab4e53023e1184e0012be5ec0941cb50f2d906f3b3f0261f1fc
5
5
  SHA512:
6
- metadata.gz: da30d06d89209f263bd559b008db96618947228c0a4ca358df3301fdbcc09adcfe04e6e2b0b07d426ca15cff22baf8e804deefc21e80e08b94372d2bee912535
7
- data.tar.gz: a6219df0e0563e79ded1216f7b81794bbf02f85aa4c68fa69b395b0a31a9a2286a3d35076dc9a1aadd67955f6badf63b76dd06f69b4437d633f92183d583d646
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lite-validators (1.7.1)
4
+ lite-validators (1.7.2)
5
5
  activemodel
6
6
 
7
7
  GEM
@@ -21,10 +21,11 @@ class ReferenceValidator < BaseValidator
21
21
  end
22
22
 
23
23
  def valid_object?
24
- association_object = options[:association] || attribute.to_s.chomp('_id')
25
- return true if record.send(association_object).present?
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(association_object, *error_message)
28
+ record.errors.add(association_type, *error_message)
28
29
  end
29
30
 
30
31
  def valid_type?
@@ -3,7 +3,7 @@
3
3
  module Lite
4
4
  module Validators
5
5
 
6
- VERSION = '1.7.1'
6
+ VERSION = '1.7.2'
7
7
 
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lite-validators
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez