activemodel 7.1.1 → 7.1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +32 -0
- data/lib/active_model/attribute.rb +3 -3
- data/lib/active_model/attribute_set.rb +1 -1
- data/lib/active_model/dirty.rb +1 -1
- data/lib/active_model/errors.rb +26 -0
- data/lib/active_model/gem_version.rb +2 -2
- data/lib/active_model/model.rb +8 -0
- data/lib/active_model/type/helpers/numeric.rb +2 -1
- data/lib/active_model/validations/validates.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62a8e27551c3779ec7676e6d2e0e66c13c2a8f95c88562722bfdcb8d9d319f2f
|
4
|
+
data.tar.gz: 2cd6f1f9bcf63a13c2688fbc6854d1173f657bfecbfca5ef9a24bd06b5c61f32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e2132e134510005376a33192f81e408fdc3e5813f368c7c8a0ce2b00328d963c94970549219a7e9b2352136a8c223da5bb2e753e9cae9e43ce2b0f6304ad8df
|
7
|
+
data.tar.gz: bb81aaefa19e40042623a008d8e4d0e062f35590f4150eabb6349dd0b394b3b0d58276b2acdf17137a09c4f25a97caf011069590ff09cebb43581a3d7549919b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,35 @@
|
|
1
|
+
## Rails 7.1.3.4 (June 04, 2024) ##
|
2
|
+
|
3
|
+
* No changes.
|
4
|
+
|
5
|
+
|
6
|
+
## Rails 7.1.3.3 (May 16, 2024) ##
|
7
|
+
|
8
|
+
* No changes.
|
9
|
+
|
10
|
+
|
11
|
+
## Rails 7.1.3.2 (February 21, 2024) ##
|
12
|
+
|
13
|
+
* No changes.
|
14
|
+
|
15
|
+
|
16
|
+
## Rails 7.1.3.1 (February 21, 2024) ##
|
17
|
+
|
18
|
+
* No changes.
|
19
|
+
|
20
|
+
|
21
|
+
## Rails 7.1.3 (January 16, 2024) ##
|
22
|
+
|
23
|
+
* No changes.
|
24
|
+
|
25
|
+
|
26
|
+
## Rails 7.1.2 (November 10, 2023) ##
|
27
|
+
|
28
|
+
* Make `==(other)` method of AttributeSet safe.
|
29
|
+
|
30
|
+
*Dmitry Pogrebnoy*
|
31
|
+
|
32
|
+
|
1
33
|
## Rails 7.1.1 (October 11, 2023) ##
|
2
34
|
|
3
35
|
* No changes.
|
@@ -178,11 +178,11 @@ module ActiveModel
|
|
178
178
|
def forgetting_assignment
|
179
179
|
# If this attribute was not persisted (with a `value_for_database`
|
180
180
|
# that might differ from `value_before_type_cast`) and `value` has not
|
181
|
-
# changed in place, we can
|
182
|
-
# deserialize / cast / serialize calls from computing the new
|
181
|
+
# changed in place, we can use the existing `value_before_type_cast`
|
182
|
+
# to avoid deserialize / cast / serialize calls from computing the new
|
183
183
|
# attribute's `value_before_type_cast`.
|
184
184
|
if !defined?(@value_for_database) && !changed_in_place?
|
185
|
-
|
185
|
+
with_value_from_database(value_before_type_cast)
|
186
186
|
else
|
187
187
|
super
|
188
188
|
end
|
data/lib/active_model/dirty.rb
CHANGED
data/lib/active_model/errors.rb
CHANGED
@@ -63,6 +63,7 @@ module ActiveModel
|
|
63
63
|
|
64
64
|
extend Forwardable
|
65
65
|
|
66
|
+
##
|
66
67
|
# :method: each
|
67
68
|
#
|
68
69
|
# :call-seq: each(&block)
|
@@ -74,6 +75,31 @@ module ActiveModel
|
|
74
75
|
# # Will yield <#ActiveModel::Error attribute=name, type=too_short,
|
75
76
|
# options={:count=>3}>
|
76
77
|
# end
|
78
|
+
|
79
|
+
##
|
80
|
+
# :method: clear
|
81
|
+
#
|
82
|
+
# :call-seq: clear
|
83
|
+
#
|
84
|
+
# Clears all errors. Clearing the errors does not, however, make the model
|
85
|
+
# valid. The next time the validations are run (for example, via
|
86
|
+
# ActiveRecord::Validations#valid?), the errors collection will be filled
|
87
|
+
# again if any validations fail.
|
88
|
+
|
89
|
+
##
|
90
|
+
# :method: empty?
|
91
|
+
#
|
92
|
+
# :call-seq: empty?
|
93
|
+
#
|
94
|
+
# Returns true if there are no errors.
|
95
|
+
|
96
|
+
##
|
97
|
+
# :method: size
|
98
|
+
#
|
99
|
+
# :call-seq: size
|
100
|
+
#
|
101
|
+
# Returns number of errors.
|
102
|
+
|
77
103
|
def_delegators :@errors, :each, :clear, :empty?, :size, :uniq!
|
78
104
|
|
79
105
|
# The actual array of +Error+ objects
|
data/lib/active_model/model.rb
CHANGED
@@ -52,6 +52,10 @@ module ActiveModel
|
|
52
52
|
# Returns a hash of the given methods with their names as keys and returned
|
53
53
|
# values as values.
|
54
54
|
#
|
55
|
+
# person = Person.new(id: 1, name: "bob")
|
56
|
+
# person.slice(:id, :name)
|
57
|
+
# => { "id" => 1, "name" => "bob" }
|
58
|
+
#
|
55
59
|
#--
|
56
60
|
# Implemented by ActiveModel::Access#slice.
|
57
61
|
|
@@ -62,6 +66,10 @@ module ActiveModel
|
|
62
66
|
#
|
63
67
|
# Returns an array of the values returned by the given methods.
|
64
68
|
#
|
69
|
+
# person = Person.new(id: 1, name: "bob")
|
70
|
+
# person.values_at(:id, :name)
|
71
|
+
# => [1, "bob"]
|
72
|
+
#
|
65
73
|
#--
|
66
74
|
# Implemented by ActiveModel::Access#values_at.
|
67
75
|
end
|
@@ -42,7 +42,8 @@ module ActiveModel
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def number_to_non_number?(old_value, new_value_before_type_cast)
|
45
|
-
old_value != nil &&
|
45
|
+
old_value != nil && !new_value_before_type_cast.is_a?(::Numeric) &&
|
46
|
+
non_numeric_string?(new_value_before_type_cast.to_s)
|
46
47
|
end
|
47
48
|
|
48
49
|
def non_numeric_string?(value)
|
@@ -10,7 +10,7 @@ module ActiveModel
|
|
10
10
|
# validators can be overridden inside specific classes by creating
|
11
11
|
# custom validator classes in their place such as PresenceValidator.
|
12
12
|
#
|
13
|
-
# Examples of using the default
|
13
|
+
# Examples of using the default \Rails validators:
|
14
14
|
#
|
15
15
|
# validates :username, absence: true
|
16
16
|
# validates :terms, acceptance: true
|
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.
|
4
|
+
version: 7.1.3.4
|
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:
|
11
|
+
date: 2024-06-04 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.
|
19
|
+
version: 7.1.3.4
|
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.
|
26
|
+
version: 7.1.3.4
|
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.
|
116
|
-
documentation_uri: https://api.rubyonrails.org/v7.1.
|
115
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.1.3.4/activemodel/CHANGELOG.md
|
116
|
+
documentation_uri: https://api.rubyonrails.org/v7.1.3.4/
|
117
117
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
118
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.1.
|
118
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.1.3.4/activemodel
|
119
119
|
rubygems_mfa_required: 'true'
|
120
120
|
post_install_message:
|
121
121
|
rdoc_options: []
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
|
-
rubygems_version: 3.
|
135
|
+
rubygems_version: 3.3.27
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: A toolkit for building modeling frameworks (part of Rails).
|