can_has_validations 1.9.0 → 1.10.0

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: 8dcfe4b967c4b3e86b61189140e744bfac77d8dcad89d58eb2109a38edfa11b2
4
- data.tar.gz: 4508998186812818da3917f68dd53ee63f865664e40f4b6132058f98dfcc9db8
3
+ metadata.gz: 6dbc656acb1fae4f12c6fc7a6f8e88e1f2c96ff47ddc612fdb7b56099e5df65b
4
+ data.tar.gz: 9a7ac65e91916c068f61005a408b09e38281bb1c724b077a76bb8e3a4017710a
5
5
  SHA512:
6
- metadata.gz: b17012db725878e4c58b5f8a89873383495db9bdbe8cdfcae2ada270392c3ba86cff232b2b79a01ae665b5424bbe5013d3a7f2c12fa77fe391e389add99352e7
7
- data.tar.gz: 40d25e2f3ddd9f24fa8465fadc90595e8013dcd0af003bd4ccd84d6626fe1fbbf47d1ae0a22fcfd9fa1b6af820e4c809835dbd5d47b913107d20f1c48918a790
6
+ metadata.gz: bbc3a6e51590d3d48dceb1ca458b0b14ba3564203e14ff1eb6bb881b7f121e5af58adf683681ecaeef946fa377a2721b098dea2bab699a5e01bd037dfbf67fc9
7
+ data.tar.gz: f219af305b401c3d7e6a4f7b36b219a03022e1979f8b0233b901b423aba502dc937296e48b0ea3da32ce12a7730760092db5b11d966a8e7bd10d5350cf9bc21d
data/README.md CHANGED
@@ -17,7 +17,7 @@ Validations provided:
17
17
  * URL
18
18
  * Write Once
19
19
 
20
- All validators use the newer Rails 3+ syntax:
20
+ All validators use the newer Rails syntax:
21
21
 
22
22
  validates :some_attribute, email: true
23
23
 
@@ -89,7 +89,7 @@ so this is useful with Mongoid as well.
89
89
 
90
90
  ## Grandparent validator ##
91
91
 
92
- Ensures two (or more) associations share a common parent value.
92
+ Ensures two (or more) associations share a common parent value.
93
93
 
94
94
  `allow_nil: true` will not only allow the attribute/association to be nil, but
95
95
  also any of the `:scope` values.
@@ -100,21 +100,21 @@ Consider a model tree like this:
100
100
  has_many :addresses
101
101
  has_many :phones
102
102
  end
103
-
103
+
104
104
  class Address < ActiveRecord::Base
105
105
  belongs_to :user
106
106
  has_many :orders
107
107
  end
108
-
108
+
109
109
  class Phone < ActiveRecord::Base
110
110
  belongs_to :user
111
111
  has_many :orders
112
112
  end
113
-
113
+
114
114
  class Order < ActiveRecord::Base
115
115
  belongs_to :address
116
116
  belongs_to :phone
117
-
117
+
118
118
  validates :phone, grandparent: {scope: :address, parent: :user}
119
119
  end
120
120
 
@@ -123,10 +123,10 @@ For any `Order`, this ensures that both `:address` and `:phone` belong to the sa
123
123
 
124
124
  Basically it starts with the attribute being validated (`:phone` in this case)
125
125
  and the scoped attributes (just `:address` in this case, but you can supply an
126
- array if needed, eg: `scope: [:billing_address, :mailing_address]` ).
126
+ array if needed, eg: `scope: [:billing_address, :mailing_address]` ).
127
127
 
128
128
  Then, it looks for the attribute that is the common parent (`:user` in the above
129
- example). So, it's looking for `phone.user` and `address.user`.
129
+ example). So, it's looking for `phone.user` and `address.user`.
130
130
 
131
131
  Finally, it's comparing those values to make sure they match. In this case, if
132
132
  `phone.user` and `address.user` match, then the validation passes. If the phone and
@@ -245,7 +245,7 @@ Always skips over nil values; use `:presence` to validate those.
245
245
  # These two are the same, except `:now` produces a clearer error message:
246
246
  validates :finish_at, after: :now
247
247
  validates :finish_at, after: ->(r){ Time.now }
248
-
248
+
249
249
  # Long versions, if you need to add extra validation options:
250
250
  validates :start_at, before: {value_of: :finish_at, message: "..." }
251
251
  validates :finish_at, after: {values_of: [:start_at, :alt_start_at], if: ... }
@@ -315,6 +315,11 @@ Default messages are as follows:
315
315
  after: "must be after %{attribute2}"
316
316
 
317
317
 
318
- ## Compatibility ##
318
+ ## Contributing
319
+
320
+ PRs are welcomed.
321
+
322
+
323
+ ## License
319
324
 
320
- The current version is tested with Ruby 2.5-2.6 and ActiveModel 5.2-6.0.
325
+ MIT
@@ -1,3 +1,3 @@
1
1
  module CanHasValidations
2
- VERSION = '1.9.0'
2
+ VERSION = '1.10.0'
3
3
  end
@@ -61,5 +61,17 @@ CanHasValidationsTest: test_truth
61
61
  TRANSACTION (0.0ms) begin transaction
62
62
  ---------------------------------
63
63
  CanHasValidationsTest: test_truth
64
+ ---------------------------------
65
+ TRANSACTION (0.0ms) rollback transaction
66
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
67
+ TRANSACTION (0.0ms) begin transaction
68
+ ---------------------------------
69
+ CanHasValidationsTest: test_truth
70
+ ---------------------------------
71
+ TRANSACTION (0.0ms) rollback transaction
72
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
73
+ TRANSACTION (0.0ms) begin transaction
74
+ ---------------------------------
75
+ CanHasValidationsTest: test_truth
64
76
  ---------------------------------
65
77
  TRANSACTION (0.0ms) rollback transaction
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: can_has_validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thomas morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-17 00:00:00.000000000 Z
11
+ date: 2024-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
19
+ version: '7.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.2'
22
+ version: '8.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '5.2'
29
+ version: '7.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7.2'
32
+ version: '8.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rake
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -48,17 +48,17 @@ dependencies:
48
48
  name: sqlite3
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: '1.4'
53
+ version: '0'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - "~>"
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: '1.4'
61
- description: 'Assorted Rails 5.x-7.x validators: Array, Email, Existence, Grandparent,
60
+ version: '0'
61
+ description: 'Assorted Rails 7.x-8.x validators: Array, Email, Existence, Grandparent,
62
62
  Hash keys, Hash values, Hostname, IP address, Ordering, URL, Write Once'
63
63
  email:
64
64
  - tm@iprog.com
@@ -140,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
140
  requirements:
141
141
  - - ">="
142
142
  - !ruby/object:Gem::Version
143
- version: '0'
143
+ version: '2.7'
144
144
  required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  requirements:
146
146
  - - ">="
@@ -150,7 +150,7 @@ requirements: []
150
150
  rubygems_version: 3.5.11
151
151
  signing_key:
152
152
  specification_version: 4
153
- summary: Assorted Rails 5.x-7.x validators
153
+ summary: Assorted Rails 7.x-8.x validators
154
154
  test_files:
155
155
  - test/can_has_validations_test.rb
156
156
  - test/dummy/README.rdoc