activemodel 7.2.2.1 → 7.2.3

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: 7abaeb86e5e7dc3786831b348d5f8deb514f1e3f2b70de2c2c7e7cd79a4c1511
4
- data.tar.gz: ecb06547a6de150912b0c81b5296cd68258958f342c9029fb7633a879710e122
3
+ metadata.gz: cd11eb90ab99961854be28823adafd875c43c0ee7d7e6067b2af752a1f183f88
4
+ data.tar.gz: 690c5e435225163f5ebee8eadeb5ebdcb6b9269140be69471e187d4bce24b7fa
5
5
  SHA512:
6
- metadata.gz: e2dbf2434ce2471c32f69df40b9ecbec73df015c1100db563bd74ceca953c6feebd94c674ab2fdef7777580f79b9aea1525d976a3ff40aabbc7efa4148b1ac5f
7
- data.tar.gz: 0c3605f04d15a6d7b7d97546183d8620b80f38d5d15c5b8e452d862721e9776d5249a3c6cd7f3b0c8b3269800db39bff939d93af92990b9680391afa5ae3e3e4
6
+ metadata.gz: c0c5710770bf4a62c45d71ccc25629f73c39f45c9c38f013abd7947c63e72c4e35ec0bfe85da0b32a4ab3c62892aadea62b78ca64e04666015a318339d544c00
7
+ data.tar.gz: e1db829ae10154c73749425d12c1749df1cbbb9f6485c68badac84f2bd945d91ae9c0022eb0d5e886c11edced5e13476be20bf49605e2b318cb2d1dd3e58d9a8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## Rails 7.2.3 (October 28, 2025) ##
2
+
3
+ * Fix `has_secure_password` to perform confirmation validation of the password even when blank.
4
+
5
+ The validation was incorrectly skipped when the password only contained whitespace characters.
6
+
7
+ *Fabio Sangiovanni*
8
+
9
+ * Handle missing attributes for `ActiveModel::Translation#human_attribute_name`.
10
+
11
+ *zzak*
12
+
13
+ * Fix `ActiveModel::AttributeAssignment#assign_attributes` to accept objects without `each`.
14
+
15
+ *Kouhei Yanagita*
16
+
17
+
18
+ ## Rails 7.2.2.2 (August 13, 2025) ##
19
+
20
+ * No changes.
21
+
22
+
1
23
  ## Rails 7.2.2.1 (December 10, 2024) ##
2
24
 
3
25
  * No changes.
data/README.rdoc CHANGED
@@ -261,6 +261,6 @@ Bug reports for the Ruby on \Rails project can be filed here:
261
261
 
262
262
  * https://github.com/rails/rails/issues
263
263
 
264
- Feature requests should be discussed on the rails-core mailing list here:
264
+ Feature requests should be discussed on the rubyonrails-core forum here:
265
265
 
266
266
  * https://discuss.rubyonrails.org/c/rubyonrails-core
@@ -38,7 +38,7 @@ module ActiveModel
38
38
 
39
39
  private
40
40
  def _assign_attributes(attributes)
41
- attributes.each do |k, v|
41
+ attributes.each_pair do |k, v|
42
42
  _assign_attribute(k, v)
43
43
  end
44
44
  end
@@ -214,7 +214,7 @@ module ActiveModel
214
214
  end
215
215
  end
216
216
 
217
- def generate_alias_attribute_methods(code_generator, new_name, old_name)
217
+ def generate_alias_attribute_methods(code_generator, new_name, old_name) # :nodoc:
218
218
  ActiveSupport::CodeGenerator.batch(code_generator, __FILE__, __LINE__) do |owner|
219
219
  attribute_method_patterns.each do |pattern|
220
220
  alias_attribute_method_definition(code_generator, pattern, new_name, old_name)
@@ -108,7 +108,7 @@ module ActiveModel
108
108
  # person.changes # => {"name" => ["Bill", "Bob"]}
109
109
  #
110
110
  # If an attribute is modified in-place then make use of
111
- # {*_will_change!}[rdoc-label:method-i-2A_will_change-21] to mark that the attribute is changing.
111
+ # {*_will_change!}[rdoc-ref:#*_will_change!] to mark that the attribute is changing.
112
112
  # Otherwise \Active \Model can't track changes to in-place attributes. Note
113
113
  # that Active Record can detect in-place modifications automatically. You do
114
114
  # not need to call <tt>*_will_change!</tt> on Active Record models.
@@ -289,22 +289,22 @@ module ActiveModel
289
289
  mutations_from_database.changed_attribute_names
290
290
  end
291
291
 
292
- # Dispatch target for {*_changed?}[rdoc-label:method-i-2A_changed-3F] attribute methods.
292
+ # Dispatch target for {*_changed?}[rdoc-ref:#*_changed?] attribute methods.
293
293
  def attribute_changed?(attr_name, **options)
294
294
  mutations_from_database.changed?(attr_name.to_s, **options)
295
295
  end
296
296
 
297
- # Dispatch target for {*_was}[rdoc-label:method-i-2A_was] attribute methods.
297
+ # Dispatch target for {*_was}[rdoc-ref:#*_was] attribute methods.
298
298
  def attribute_was(attr_name)
299
299
  mutations_from_database.original_value(attr_name.to_s)
300
300
  end
301
301
 
302
- # Dispatch target for {*_previously_changed?}[rdoc-label:method-i-2A_previously_changed-3F] attribute methods.
302
+ # Dispatch target for {*_previously_changed?}[rdoc-ref:#*_previously_changed?] attribute methods.
303
303
  def attribute_previously_changed?(attr_name, **options)
304
304
  mutations_before_last_save.changed?(attr_name.to_s, **options)
305
305
  end
306
306
 
307
- # Dispatch target for {*_previously_was}[rdoc-label:method-i-2A_previously_was] attribute methods.
307
+ # Dispatch target for {*_previously_was}[rdoc-ref:#*_previously_was] attribute methods.
308
308
  def attribute_previously_was(attr_name)
309
309
  mutations_before_last_save.original_value(attr_name.to_s)
310
310
  end
@@ -9,8 +9,8 @@ module ActiveModel
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 2
12
- TINY = 2
13
- PRE = "1"
12
+ TINY = 3
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -54,7 +54,7 @@ module ActiveModel
54
54
  #
55
55
  # person = Person.new(id: 1, name: "bob")
56
56
  # person.slice(:id, :name)
57
- # => { "id" => 1, "name" => "bob" }
57
+ # # => { "id" => 1, "name" => "bob" }
58
58
  #
59
59
  #--
60
60
  # Implemented by ActiveModel::Access#slice.
@@ -68,7 +68,7 @@ module ActiveModel
68
68
  #
69
69
  # person = Person.new(id: 1, name: "bob")
70
70
  # person.values_at(:id, :name)
71
- # => [1, "bob"]
71
+ # # => [1, "bob"]
72
72
  #
73
73
  #--
74
74
  # Implemented by ActiveModel::Access#values_at.
@@ -140,7 +140,7 @@ module ActiveModel
140
140
  end
141
141
  end
142
142
 
143
- validates_confirmation_of attribute, allow_blank: true
143
+ validates_confirmation_of attribute, allow_nil: true
144
144
  end
145
145
  end
146
146
  end
@@ -50,10 +50,19 @@ module ActiveModel
50
50
  namespace, _, attribute = attribute.rpartition(".")
51
51
  namespace.tr!(".", "/")
52
52
 
53
+ if attribute.present?
54
+ key = "#{namespace}.#{attribute}"
55
+ separator = "/"
56
+ else
57
+ key = namespace
58
+ separator = "."
59
+ end
60
+
53
61
  defaults = lookup_ancestors.map do |klass|
54
- :"#{i18n_scope}.attributes.#{klass.model_name.i18n_key}/#{namespace}.#{attribute}"
62
+ :"#{i18n_scope}.attributes.#{klass.model_name.i18n_key}#{separator}#{key}"
55
63
  end
56
- defaults << :"#{i18n_scope}.attributes.#{namespace}.#{attribute}"
64
+ defaults << :"#{i18n_scope}.attributes.#{key}"
65
+ defaults << :"attributes.#{key}"
57
66
  else
58
67
  defaults = lookup_ancestors.map do |klass|
59
68
  :"#{i18n_scope}.attributes.#{klass.model_name.i18n_key}.#{attribute}"
@@ -65,7 +74,10 @@ module ActiveModel
65
74
  defaults << MISSING_TRANSLATION
66
75
 
67
76
  translation = I18n.translate(defaults.shift, count: 1, **options, default: defaults)
68
- translation = attribute.humanize if translation == MISSING_TRANSLATION
77
+ if translation == MISSING_TRANSLATION
78
+ translation = attribute.present? ? attribute.humanize : namespace.humanize
79
+ end
80
+
69
81
  translation
70
82
  end
71
83
  end
@@ -15,14 +15,6 @@ module ActiveModel
15
15
  # attribute :weight, :float
16
16
  # end
17
17
  #
18
- # Values are cast using their +to_f+ method, except for the following
19
- # strings:
20
- #
21
- # - Blank strings are cast to +nil+.
22
- # - <tt>"Infinity"</tt> is cast to +Float::INFINITY+.
23
- # - <tt>"-Infinity"</tt> is cast to <tt>-Float::INFINITY</tt>.
24
- # - <tt>"NaN"</tt> is cast to +Float::NAN+.
25
- #
26
18
  # bag = BagOfCoffee.new
27
19
  #
28
20
  # bag.weight = "0.25"
@@ -33,6 +25,14 @@ module ActiveModel
33
25
  #
34
26
  # bag.weight = "NaN"
35
27
  # bag.weight # => Float::NAN
28
+ #
29
+ # Values are cast using their +to_f+ method, except for the following
30
+ # strings:
31
+ #
32
+ # - Blank strings are cast to +nil+.
33
+ # - <tt>"Infinity"</tt> is cast to +Float::INFINITY+.
34
+ # - <tt>"-Infinity"</tt> is cast to <tt>-Float::INFINITY</tt>.
35
+ # - <tt>"NaN"</tt> is cast to +Float::NAN+.
36
36
  class Float < Value
37
37
  include Helpers::Numeric
38
38
 
@@ -84,7 +84,8 @@ module ActiveModel
84
84
  # end
85
85
  # end
86
86
  #
87
- # Options:
87
+ # ==== Options
88
+ #
88
89
  # * <tt>:on</tt> - Specifies the contexts where this validation is active.
89
90
  # Runs in all validation contexts by default +nil+. You can pass a symbol
90
91
  # or an array of symbols. (e.g. <tt>on: :create</tt> or
@@ -150,7 +151,8 @@ module ActiveModel
150
151
  # Note that the return value of validation methods is not relevant.
151
152
  # It's not possible to halt the validate callback chain.
152
153
  #
153
- # Options:
154
+ # ==== Options
155
+ #
154
156
  # * <tt>:on</tt> - Specifies the contexts where this validation is active.
155
157
  # Runs in all validation contexts by default +nil+. You can pass a symbol
156
158
  # or an array of symbols. (e.g. <tt>on: :create</tt> or
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemodel
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.2.1
4
+ version: 7.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-10 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: activesupport
@@ -16,14 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - '='
18
17
  - !ruby/object:Gem::Version
19
- version: 7.2.2.1
18
+ version: 7.2.3
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - '='
25
24
  - !ruby/object:Gem::Version
26
- version: 7.2.2.1
25
+ version: 7.2.3
27
26
  description: A toolkit for building modeling frameworks like Active Record. Rich support
28
27
  for attributes, callbacks, validations, serialization, internationalization, and
29
28
  testing.
@@ -112,12 +111,11 @@ licenses:
112
111
  - MIT
113
112
  metadata:
114
113
  bug_tracker_uri: https://github.com/rails/rails/issues
115
- changelog_uri: https://github.com/rails/rails/blob/v7.2.2.1/activemodel/CHANGELOG.md
116
- documentation_uri: https://api.rubyonrails.org/v7.2.2.1/
114
+ changelog_uri: https://github.com/rails/rails/blob/v7.2.3/activemodel/CHANGELOG.md
115
+ documentation_uri: https://api.rubyonrails.org/v7.2.3/
117
116
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
118
- source_code_uri: https://github.com/rails/rails/tree/v7.2.2.1/activemodel
117
+ source_code_uri: https://github.com/rails/rails/tree/v7.2.3/activemodel
119
118
  rubygems_mfa_required: 'true'
120
- post_install_message:
121
119
  rdoc_options: []
122
120
  require_paths:
123
121
  - lib
@@ -132,8 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
130
  - !ruby/object:Gem::Version
133
131
  version: '0'
134
132
  requirements: []
135
- rubygems_version: 3.5.22
136
- signing_key:
133
+ rubygems_version: 3.6.9
137
134
  specification_version: 4
138
135
  summary: A toolkit for building modeling frameworks (part of Rails).
139
136
  test_files: []