activemodel 7.1.0.beta1 → 7.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/active_model/errors.rb +6 -6
- data/lib/active_model/gem_version.rb +1 -1
- data/lib/active_model/locale/en.yml +3 -3
- data/lib/active_model/secure_password.rb +1 -1
- data/lib/active_model/validations/confirmation.rb +1 -1
- data/lib/active_model/validations/presence.rb +1 -1
- data/lib/active_model/validations/validates.rb +1 -1
- data/lib/active_model/validations.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04434ed8708ba750cd446164784fba65ea2add849c90c5184f6e2ac45167b6fd
|
4
|
+
data.tar.gz: 3b327c5bda9daca4fd7fb7a1af6cedf24cc60277bfe4e7ed49c62746c5142f8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b69585501d6520f9219ec1d4663a41fa221c88fb80e6d6c0994dba0069d695ac559fe5389a249d24317f61c423e697a4e59f7cc89e1efbb39498a26ad6fd82e8
|
7
|
+
data.tar.gz: 6b5645a9fa5d5f223403af582be720f7dec40538d2a064f1752865c1697253a8ec87201420b4981913d0459bd386a2cf5d0a64da501ba6823ad062339a139ee6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## Rails 7.1.0.rc1 (September 27, 2023) ##
|
2
|
+
|
3
|
+
* Remove change in the typography of user facing error messages.
|
4
|
+
For example, “can’t be blank” is again “can't be blank”.
|
5
|
+
|
6
|
+
*Rafael Mendonça França*
|
7
|
+
|
8
|
+
|
1
9
|
## Rails 7.1.0.beta1 (September 13, 2023) ##
|
2
10
|
|
3
11
|
* Support composite identifiers in `to_key`
|
@@ -176,6 +184,10 @@
|
|
176
184
|
validates_inclusion_of :birth_date, in: -> { (..Date.today) }
|
177
185
|
```
|
178
186
|
|
187
|
+
```ruby
|
188
|
+
validates_exclusion_of :birth_date, in: -> { (..Date.today) }
|
189
|
+
```
|
190
|
+
|
179
191
|
*Bo Jeanes*
|
180
192
|
|
181
193
|
* Make validators accept lambdas without record argument
|
data/lib/active_model/errors.rb
CHANGED
@@ -284,7 +284,7 @@ module ActiveModel
|
|
284
284
|
#
|
285
285
|
# person.errors.add(:name, :blank)
|
286
286
|
# person.errors.messages
|
287
|
-
# # => {:name=>["can
|
287
|
+
# # => {:name=>["can't be blank"]}
|
288
288
|
#
|
289
289
|
# person.errors.add(:name, :too_long, count: 25)
|
290
290
|
# person.errors.messages
|
@@ -332,7 +332,7 @@ module ActiveModel
|
|
332
332
|
#
|
333
333
|
# person.errors.add :name, :blank
|
334
334
|
# person.errors.added? :name, :blank # => true
|
335
|
-
# person.errors.added? :name, "can
|
335
|
+
# person.errors.added? :name, "can't be blank" # => true
|
336
336
|
#
|
337
337
|
# If the error requires options, then it returns +true+ with
|
338
338
|
# the correct options, or +false+ with incorrect or missing options.
|
@@ -385,7 +385,7 @@ module ActiveModel
|
|
385
385
|
#
|
386
386
|
# person = Person.create(address: '123 First St.')
|
387
387
|
# person.errors.full_messages
|
388
|
-
# # => ["Name is too short (minimum is 5 characters)", "Name can
|
388
|
+
# # => ["Name is too short (minimum is 5 characters)", "Name can't be blank", "Email can't be blank"]
|
389
389
|
def full_messages
|
390
390
|
@errors.map(&:full_message)
|
391
391
|
end
|
@@ -400,7 +400,7 @@ module ActiveModel
|
|
400
400
|
#
|
401
401
|
# person = Person.create()
|
402
402
|
# person.errors.full_messages_for(:name)
|
403
|
-
# # => ["Name is too short (minimum is 5 characters)", "Name can
|
403
|
+
# # => ["Name is too short (minimum is 5 characters)", "Name can't be blank"]
|
404
404
|
def full_messages_for(attribute)
|
405
405
|
where(attribute).map(&:full_message).freeze
|
406
406
|
end
|
@@ -414,7 +414,7 @@ module ActiveModel
|
|
414
414
|
#
|
415
415
|
# person = Person.create()
|
416
416
|
# person.errors.messages_for(:name)
|
417
|
-
# # => ["is too short (minimum is 5 characters)", "can
|
417
|
+
# # => ["is too short (minimum is 5 characters)", "can't be blank"]
|
418
418
|
def messages_for(attribute)
|
419
419
|
where(attribute).map(&:message)
|
420
420
|
end
|
@@ -487,7 +487,7 @@ module ActiveModel
|
|
487
487
|
# person = Person.new
|
488
488
|
# person.name = nil
|
489
489
|
# person.valid?
|
490
|
-
# # => ActiveModel::StrictValidationFailed: Name can
|
490
|
+
# # => ActiveModel::StrictValidationFailed: Name can't be blank
|
491
491
|
class StrictValidationFailed < StandardError
|
492
492
|
end
|
493
493
|
|
@@ -10,10 +10,10 @@ en:
|
|
10
10
|
inclusion: "is not included in the list"
|
11
11
|
exclusion: "is reserved"
|
12
12
|
invalid: "is invalid"
|
13
|
-
confirmation: "doesn
|
13
|
+
confirmation: "doesn't match %{attribute}"
|
14
14
|
accepted: "must be accepted"
|
15
|
-
empty: "can
|
16
|
-
blank: "can
|
15
|
+
empty: "can't be empty"
|
16
|
+
blank: "can't be blank"
|
17
17
|
present: "must be blank"
|
18
18
|
too_long:
|
19
19
|
one: "is too long (maximum is 1 character)"
|
@@ -57,7 +57,7 @@ module ActiveModel
|
|
57
57
|
#
|
58
58
|
# user.save # => false, password required
|
59
59
|
# user.password = "vr00m"
|
60
|
-
# user.save # => false, confirmation doesn
|
60
|
+
# user.save # => false, confirmation doesn't match
|
61
61
|
# user.password_confirmation = "vr00m"
|
62
62
|
# user.save # => true
|
63
63
|
#
|
@@ -64,7 +64,7 @@ module ActiveModel
|
|
64
64
|
# validates_presence_of :password_confirmation, if: :password_changed?
|
65
65
|
#
|
66
66
|
# Configuration options:
|
67
|
-
# * <tt>:message</tt> - A custom error message (default is: "doesn
|
67
|
+
# * <tt>:message</tt> - A custom error message (default is: "doesn't match
|
68
68
|
# <tt>%{translated_attribute_name}</tt>").
|
69
69
|
# * <tt>:case_sensitive</tt> - Looks for an exact match. Ignored by
|
70
70
|
# non-text columns (+true+ by default).
|
@@ -26,7 +26,7 @@ module ActiveModel
|
|
26
26
|
# <tt>false.blank? # => true</tt>.
|
27
27
|
#
|
28
28
|
# Configuration options:
|
29
|
-
# * <tt>:message</tt> - A custom error message (default is: "can
|
29
|
+
# * <tt>:message</tt> - A custom error message (default is: "can't be blank").
|
30
30
|
#
|
31
31
|
# There is also a list of default options supported by every validator:
|
32
32
|
# +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+.
|
@@ -144,7 +144,7 @@ module ActiveModel
|
|
144
144
|
# person = Person.new
|
145
145
|
# person.name = ''
|
146
146
|
# person.valid?
|
147
|
-
# # => ActiveModel::StrictValidationFailed: Name can
|
147
|
+
# # => ActiveModel::StrictValidationFailed: Name can't be blank
|
148
148
|
def validates!(*attributes)
|
149
149
|
options = attributes.extract_options!
|
150
150
|
options[:strict] = true
|
@@ -326,7 +326,7 @@ module ActiveModel
|
|
326
326
|
#
|
327
327
|
# person = Person.new
|
328
328
|
# person.valid? # => false
|
329
|
-
# person.errors # => #<ActiveModel::Errors:0x007fe603816640 @messages={name:["can
|
329
|
+
# person.errors # => #<ActiveModel::Errors:0x007fe603816640 @messages={name:["can't be blank"]}>
|
330
330
|
def errors
|
331
331
|
@errors ||= Errors.new(self)
|
332
332
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activemodel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.1.0.
|
4
|
+
version: 7.1.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 7.1.0.
|
19
|
+
version: 7.1.0.rc1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 7.1.0.
|
26
|
+
version: 7.1.0.rc1
|
27
27
|
description: A toolkit for building modeling frameworks like Active Record. Rich support
|
28
28
|
for attributes, callbacks, validations, serialization, internationalization, and
|
29
29
|
testing.
|
@@ -112,10 +112,10 @@ licenses:
|
|
112
112
|
- MIT
|
113
113
|
metadata:
|
114
114
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
115
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.1.0.
|
116
|
-
documentation_uri: https://api.rubyonrails.org/v7.1.0.
|
115
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.1.0.rc1/activemodel/CHANGELOG.md
|
116
|
+
documentation_uri: https://api.rubyonrails.org/v7.1.0.rc1/
|
117
117
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
118
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.1.0.
|
118
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.1.0.rc1/activemodel
|
119
119
|
rubygems_mfa_required: 'true'
|
120
120
|
post_install_message:
|
121
121
|
rdoc_options: []
|