can_has_validations 1.9.0 → 1.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: 8dcfe4b967c4b3e86b61189140e744bfac77d8dcad89d58eb2109a38edfa11b2
4
- data.tar.gz: 4508998186812818da3917f68dd53ee63f865664e40f4b6132058f98dfcc9db8
3
+ metadata.gz: 265cc0daee73649e7814d073dcb6243a700fc95d44465a3e65d8873c747d70fc
4
+ data.tar.gz: 38ed63f29a3801450380bb3024279ddfdcbd018a68bfca9a57fa3a7d057e7982
5
5
  SHA512:
6
- metadata.gz: b17012db725878e4c58b5f8a89873383495db9bdbe8cdfcae2ada270392c3ba86cff232b2b79a01ae665b5424bbe5013d3a7f2c12fa77fe391e389add99352e7
7
- data.tar.gz: 40d25e2f3ddd9f24fa8465fadc90595e8013dcd0af003bd4ccd84d6626fe1fbbf47d1ae0a22fcfd9fa1b6af820e4c809835dbd5d47b913107d20f1c48918a790
6
+ metadata.gz: 00ddc79d0260617c6b4563bc80d0d3e9f3e265c1a635c91f0be6b785efd57ff453d76a9d0146d536771e8f7cd1e17d2d1a8d5716c6c5b8f3839f5669735f0c47
7
+ data.tar.gz: d7903a4fb900618b36020e56207391c6c88bb31d77d6fc524c003015852f17e8e6837561bf057eee73ed83a6e0e6f220f931dc2507fadea1cb793fed34095625
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2012-2024 thomas morgan
1
+ Copyright 2012-2025 thomas morgan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
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.11.0'
3
3
  end
@@ -10,7 +10,7 @@ require "can_has_validations"
10
10
  module Dummy
11
11
  class Application < Rails::Application
12
12
  # Initialize configuration defaults for originally generated Rails version.
13
- config.load_defaults 7.0
13
+ config.load_defaults Rails::VERSION::STRING.to_f
14
14
 
15
15
  # Configuration for the application, engines, and railties goes here.
16
16
  #
@@ -63,3 +63,51 @@ CanHasValidationsTest: test_truth
63
63
  CanHasValidationsTest: test_truth
64
64
  ---------------------------------
65
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
76
+ ---------------------------------
77
+ TRANSACTION (0.0ms) rollback transaction
78
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
79
+ TRANSACTION (0.0ms) begin transaction
80
+ ---------------------------------
81
+ CanHasValidationsTest: test_truth
82
+ ---------------------------------
83
+ TRANSACTION (0.0ms) rollback transaction
84
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
85
+ TRANSACTION (0.0ms) begin transaction
86
+ ---------------------------------
87
+ CanHasValidationsTest: test_truth
88
+ ---------------------------------
89
+ TRANSACTION (0.0ms) rollback transaction
90
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
91
+ TRANSACTION (0.0ms) BEGIN deferred TRANSACTION
92
+ ---------------------------------
93
+ CanHasValidationsTest: test_truth
94
+ ---------------------------------
95
+ TRANSACTION (0.0ms) ROLLBACK TRANSACTION
96
+ ActiveRecord::SchemaMigration Load (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
97
+ TRANSACTION (0.0ms) BEGIN deferred TRANSACTION
98
+ ---------------------------------
99
+ CanHasValidationsTest: test_truth
100
+ ---------------------------------
101
+ TRANSACTION (0.1ms) ROLLBACK TRANSACTION
102
+ ActiveRecord::SchemaMigration Load (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
103
+ TRANSACTION (0.0ms) BEGIN deferred TRANSACTION
104
+ ---------------------------------
105
+ CanHasValidationsTest: test_truth
106
+ ---------------------------------
107
+ TRANSACTION (0.0ms) ROLLBACK TRANSACTION
108
+ ActiveRecord::SchemaMigration Load (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
109
+ TRANSACTION (0.0ms) BEGIN deferred TRANSACTION
110
+ ---------------------------------
111
+ CanHasValidationsTest: test_truth
112
+ ---------------------------------
113
+ TRANSACTION (0.0ms) ROLLBACK TRANSACTION
metadata CHANGED
@@ -1,14 +1,13 @@
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.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thomas morgan
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-07-17 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rails
@@ -16,20 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '5.2'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '7.2'
18
+ version: '7.0'
23
19
  type: :runtime
24
20
  prerelease: false
25
21
  version_requirements: !ruby/object:Gem::Requirement
26
22
  requirements:
27
23
  - - ">="
28
24
  - !ruby/object:Gem::Version
29
- version: '5.2'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '7.2'
25
+ version: '7.0'
33
26
  - !ruby/object:Gem::Dependency
34
27
  name: rake
35
28
  requirement: !ruby/object:Gem::Requirement
@@ -48,17 +41,17 @@ dependencies:
48
41
  name: sqlite3
49
42
  requirement: !ruby/object:Gem::Requirement
50
43
  requirements:
51
- - - "~>"
44
+ - - ">="
52
45
  - !ruby/object:Gem::Version
53
- version: '1.4'
46
+ version: '0'
54
47
  type: :development
55
48
  prerelease: false
56
49
  version_requirements: !ruby/object:Gem::Requirement
57
50
  requirements:
58
- - - "~>"
51
+ - - ">="
59
52
  - !ruby/object:Gem::Version
60
- version: '1.4'
61
- description: 'Assorted Rails 5.x-7.x validators: Array, Email, Existence, Grandparent,
53
+ version: '0'
54
+ description: 'Assorted Rails 7.x-8.x validators: Array, Email, Existence, Grandparent,
62
55
  Hash keys, Hash values, Hostname, IP address, Ordering, URL, Write Once'
63
56
  email:
64
57
  - tm@iprog.com
@@ -132,7 +125,6 @@ homepage: https://github.com/zarqman/can_has_validations
132
125
  licenses:
133
126
  - MIT
134
127
  metadata: {}
135
- post_install_message:
136
128
  rdoc_options: []
137
129
  require_paths:
138
130
  - lib
@@ -140,17 +132,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
132
  requirements:
141
133
  - - ">="
142
134
  - !ruby/object:Gem::Version
143
- version: '0'
135
+ version: '2.7'
144
136
  required_rubygems_version: !ruby/object:Gem::Requirement
145
137
  requirements:
146
138
  - - ">="
147
139
  - !ruby/object:Gem::Version
148
140
  version: '0'
149
141
  requirements: []
150
- rubygems_version: 3.5.11
151
- signing_key:
142
+ rubygems_version: 3.6.9
152
143
  specification_version: 4
153
- summary: Assorted Rails 5.x-7.x validators
144
+ summary: Assorted Rails 7.x-8.x validators
154
145
  test_files:
155
146
  - test/can_has_validations_test.rb
156
147
  - test/dummy/README.rdoc
@@ -163,6 +154,7 @@ test_files:
163
154
  - test/dummy/bin/rails
164
155
  - test/dummy/bin/rake
165
156
  - test/dummy/bin/setup
157
+ - test/dummy/config.ru
166
158
  - test/dummy/config/application.rb
167
159
  - test/dummy/config/boot.rb
168
160
  - test/dummy/config/cable.yml
@@ -183,7 +175,6 @@ test_files:
183
175
  - test/dummy/config/locales/en.yml
184
176
  - test/dummy/config/routes.rb
185
177
  - test/dummy/config/storage.yml
186
- - test/dummy/config.ru
187
178
  - test/dummy/db/test.sqlite3
188
179
  - test/dummy/log/test.log
189
180
  - test/dummy/public/404.html