recheck 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: faf3315050bcbc7ab154eb611f32e305b4ad49b14a39582a617ec2a2b14a76fb
4
- data.tar.gz: 4a63283916b6faa3e34eb2a6a1f3cde72b80bc24d95cd69638a808e890f434f2
3
+ metadata.gz: 7ed938fcd273c69ba857b5729ba3ccff01c7d28c8366b79ce535fcfcd2cbfb41
4
+ data.tar.gz: '042031449c9f5f5a8bac601989cfeb31078d96c23de77dd286c69d377d59d337'
5
5
  SHA512:
6
- metadata.gz: f14ce4e3f3c061397957bfd75269342e8189672a074a4d812765ffa8dfdda849cee36e32a246a7ae2a09fc0ea8d352fb07c25a20f303c4fecad513b5836f68ac
7
- data.tar.gz: 8869c1627a1dfeb9c8e9b6d53d7472f41f2d85d7584a0c0c0294212dc2203a39a38ddcd4aa9a20a0ef42fbaa340767ff7167b20f4023a3ad654aec64f704e7be
6
+ metadata.gz: 986e0b292abeac691e4b0be455b392ffc22e4254a8f486989f6e7b0426e3ecd52c682fc2f423e3c4e3f32c132f07f8c653836f57e422d0345505d7f03a52fb03
7
+ data.tar.gz: '01388c2573c2717039f16502b583d0b09fda3194f628eb0123a353b863e5320d16e2de76e627cf1e112f1a25fc3ea19b649d4d823dedc4090558155e123bacf4'
data/changelog.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## ## [Unreleased]
2
2
 
3
+ ## 0.11.0 - 2025-09-06
4
+
5
+ * Fixed ActiveRecord length validation with allow_blank.
6
+
3
7
  ## 0.10.0 - 2025-09-05
4
8
 
5
9
  * Fixed :is ActiveRecord length validation
@@ -96,7 +96,7 @@ module Recheck
96
96
  or_clauses = []
97
97
  if type == :string || type == :text || type == :integer
98
98
  if validator.options[:is]
99
- or_clauses << %{"LENGTH(`#{column.name}`) = #{validator.options[:is]})"}
99
+ or_clauses << %{"LENGTH(`#{column.name}`) != #{validator.options[:is]}"}
100
100
  end
101
101
  if validator.options[:minimum] && validator.options[:maximum]
102
102
  or_clauses << %{"LENGTH(`#{column.name}`) < #{validator.options[:minimum]} and LENGTH(`#{column.name}`) > #{validator.options[:maximum]}"}
@@ -105,6 +105,9 @@ module Recheck
105
105
  elsif validator.options[:maximum]
106
106
  or_clauses << %{"LENGTH(`#{column.name}`) > #{validator.options[:maximum]}"}
107
107
  end
108
+ if validator.options[:allow_blank]
109
+ or_clauses = or_clauses.map { |clause| clause[..-2] + %( and `#{column.name}` != ''") }
110
+ end
108
111
  elsif type == :boolean
109
112
  comment = "Validating length of a boolean is backend-dependent and a strange idea."
110
113
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Recheck
4
- VERSION = '0.10.0'
4
+ VERSION = '0.11.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recheck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bhat Harkins