activemodel 7.2.2.2 → 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 +4 -4
 - data/CHANGELOG.md +17 -0
 - data/README.rdoc +1 -1
 - data/lib/active_model/attribute_assignment.rb +1 -1
 - data/lib/active_model/attribute_methods.rb +1 -1
 - data/lib/active_model/dirty.rb +5 -5
 - data/lib/active_model/gem_version.rb +2 -2
 - data/lib/active_model/model.rb +2 -2
 - data/lib/active_model/secure_password.rb +1 -1
 - data/lib/active_model/translation.rb +15 -3
 - data/lib/active_model/type/float.rb +8 -8
 - data/lib/active_model/validations.rb +4 -2
 - metadata +6 -6
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: cd11eb90ab99961854be28823adafd875c43c0ee7d7e6067b2af752a1f183f88
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 690c5e435225163f5ebee8eadeb5ebdcb6b9269140be69471e187d4bce24b7fa
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: c0c5710770bf4a62c45d71ccc25629f73c39f45c9c38f013abd7947c63e72c4e35ec0bfe85da0b32a4ab3c62892aadea62b78ca64e04666015a318339d544c00
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: e1db829ae10154c73749425d12c1749df1cbbb9f6485c68badac84f2bd945d91ae9c0022eb0d5e886c11edced5e13476be20bf49605e2b318cb2d1dd3e58d9a8
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,3 +1,20 @@ 
     | 
|
| 
      
 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 
     | 
    
         
            +
             
     | 
| 
       1 
18 
     | 
    
         
             
            ## Rails 7.2.2.2 (August 13, 2025) ##
         
     | 
| 
       2 
19 
     | 
    
         | 
| 
       3 
20 
     | 
    
         
             
            *   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  
     | 
| 
      
 264 
     | 
    
         
            +
            Feature requests should be discussed on the rubyonrails-core forum here:
         
     | 
| 
       265 
265 
     | 
    
         | 
| 
       266 
266 
     | 
    
         
             
            * https://discuss.rubyonrails.org/c/rubyonrails-core
         
     | 
| 
         @@ -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)
         
     | 
    
        data/lib/active_model/dirty.rb
    CHANGED
    
    | 
         @@ -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- 
     | 
| 
      
 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- 
     | 
| 
      
 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- 
     | 
| 
      
 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- 
     | 
| 
      
 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- 
     | 
| 
      
 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
         
     | 
    
        data/lib/active_model/model.rb
    CHANGED
    
    | 
         @@ -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.
         
     | 
| 
         @@ -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} 
     | 
| 
      
 62 
     | 
    
         
            +
                      :"#{i18n_scope}.attributes.#{klass.model_name.i18n_key}#{separator}#{key}"
         
     | 
| 
       55 
63 
     | 
    
         
             
                    end
         
     | 
| 
       56 
     | 
    
         
            -
                    defaults << :"#{i18n_scope}.attributes.#{ 
     | 
| 
      
 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 
     | 
    
         
            -
                   
     | 
| 
      
 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,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: activemodel
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 7.2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 7.2.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - David Heinemeier Hansson
         
     | 
| 
         @@ -15,14 +15,14 @@ dependencies: 
     | 
|
| 
       15 
15 
     | 
    
         
             
                requirements:
         
     | 
| 
       16 
16 
     | 
    
         
             
                - - '='
         
     | 
| 
       17 
17 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       18 
     | 
    
         
            -
                    version: 7.2. 
     | 
| 
      
 18 
     | 
    
         
            +
                    version: 7.2.3
         
     | 
| 
       19 
19 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       20 
20 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       21 
21 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       22 
22 
     | 
    
         
             
                requirements:
         
     | 
| 
       23 
23 
     | 
    
         
             
                - - '='
         
     | 
| 
       24 
24 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       25 
     | 
    
         
            -
                    version: 7.2. 
     | 
| 
      
 25 
     | 
    
         
            +
                    version: 7.2.3
         
     | 
| 
       26 
26 
     | 
    
         
             
            description: A toolkit for building modeling frameworks like Active Record. Rich support
         
     | 
| 
       27 
27 
     | 
    
         
             
              for attributes, callbacks, validations, serialization, internationalization, and
         
     | 
| 
       28 
28 
     | 
    
         
             
              testing.
         
     | 
| 
         @@ -111,10 +111,10 @@ licenses: 
     | 
|
| 
       111 
111 
     | 
    
         
             
            - MIT
         
     | 
| 
       112 
112 
     | 
    
         
             
            metadata:
         
     | 
| 
       113 
113 
     | 
    
         
             
              bug_tracker_uri: https://github.com/rails/rails/issues
         
     | 
| 
       114 
     | 
    
         
            -
              changelog_uri: https://github.com/rails/rails/blob/v7.2. 
     | 
| 
       115 
     | 
    
         
            -
              documentation_uri: https://api.rubyonrails.org/v7.2. 
     | 
| 
      
 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/
         
     | 
| 
       116 
116 
     | 
    
         
             
              mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
         
     | 
| 
       117 
     | 
    
         
            -
              source_code_uri: https://github.com/rails/rails/tree/v7.2. 
     | 
| 
      
 117 
     | 
    
         
            +
              source_code_uri: https://github.com/rails/rails/tree/v7.2.3/activemodel
         
     | 
| 
       118 
118 
     | 
    
         
             
              rubygems_mfa_required: 'true'
         
     | 
| 
       119 
119 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       120 
120 
     | 
    
         
             
            require_paths:
         
     |