activemodel 7.0.8.6 → 7.0.9
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 +10 -0
 - data/lib/active_model/errors.rb +26 -0
 - data/lib/active_model/gem_version.rb +2 -2
 - data/lib/active_model/type/helpers/numeric.rb +2 -1
 - data/lib/active_model/validations/validates.rb +1 -1
 - metadata +8 -11
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: af1e130b7197eb4b28a28f40a1b6725b6a8cfa5346decedfe8998450488e3d72
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: cb038e74ff610855bbcbc3d74adf21764daf3488ee2912ad1c34514fdfbfbd07
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: bfc0222183ff431a501a8d5efd8630714d1a8316cd714447caea4044a25044df13d6f6339b0cf0ee664307f19dd26aeb313e57f23c2e81929e0f1e1bb15e3e9f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 07c2a80270a55882b2e779dd28ff515cf5339a7bbb773fe23d4eb4473cb1fbe8ae6f61be49404fdce686bf6c900bff6bd902d4e5f0318942fb345491bb5d925a
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/lib/active_model/errors.rb
    CHANGED
    
    | 
         @@ -64,6 +64,7 @@ module ActiveModel 
     | 
|
| 
       64 
64 
     | 
    
         | 
| 
       65 
65 
     | 
    
         
             
                extend Forwardable
         
     | 
| 
       66 
66 
     | 
    
         | 
| 
      
 67 
     | 
    
         
            +
                ##
         
     | 
| 
       67 
68 
     | 
    
         
             
                # :method: each
         
     | 
| 
       68 
69 
     | 
    
         
             
                #
         
     | 
| 
       69 
70 
     | 
    
         
             
                # :call-seq: each(&block)
         
     | 
| 
         @@ -75,6 +76,31 @@ module ActiveModel 
     | 
|
| 
       75 
76 
     | 
    
         
             
                #     # Will yield <#ActiveModel::Error attribute=name, type=too_short,
         
     | 
| 
       76 
77 
     | 
    
         
             
                #                                       options={:count=>3}>
         
     | 
| 
       77 
78 
     | 
    
         
             
                #   end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
                ##
         
     | 
| 
      
 81 
     | 
    
         
            +
                # :method: clear
         
     | 
| 
      
 82 
     | 
    
         
            +
                #
         
     | 
| 
      
 83 
     | 
    
         
            +
                # :call-seq: clear
         
     | 
| 
      
 84 
     | 
    
         
            +
                #
         
     | 
| 
      
 85 
     | 
    
         
            +
                # Clears all errors. Clearing the errors does not, however, make the model
         
     | 
| 
      
 86 
     | 
    
         
            +
                # valid. The next time the validations are run (for example, via
         
     | 
| 
      
 87 
     | 
    
         
            +
                # ActiveRecord::Validations#valid?), the errors collection will be filled
         
     | 
| 
      
 88 
     | 
    
         
            +
                # again if any validations fail.
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                ##
         
     | 
| 
      
 91 
     | 
    
         
            +
                # :method: empty?
         
     | 
| 
      
 92 
     | 
    
         
            +
                #
         
     | 
| 
      
 93 
     | 
    
         
            +
                # :call-seq: empty?
         
     | 
| 
      
 94 
     | 
    
         
            +
                #
         
     | 
| 
      
 95 
     | 
    
         
            +
                # Returns true if there are no errors.
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                ##
         
     | 
| 
      
 98 
     | 
    
         
            +
                # :method: size
         
     | 
| 
      
 99 
     | 
    
         
            +
                #
         
     | 
| 
      
 100 
     | 
    
         
            +
                # :call-seq: size
         
     | 
| 
      
 101 
     | 
    
         
            +
                #
         
     | 
| 
      
 102 
     | 
    
         
            +
                # Returns number of errors.
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
       78 
104 
     | 
    
         
             
                def_delegators :@errors, :each, :clear, :empty?, :size, :uniq!
         
     | 
| 
       79 
105 
     | 
    
         | 
| 
       80 
106 
     | 
    
         
             
                # The actual array of +Error+ objects
         
     | 
| 
         @@ -38,7 +38,8 @@ module ActiveModel 
     | 
|
| 
       38 
38 
     | 
    
         
             
                      end
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
                      def number_to_non_number?(old_value, new_value_before_type_cast)
         
     | 
| 
       41 
     | 
    
         
            -
                        old_value != nil &&  
     | 
| 
      
 41 
     | 
    
         
            +
                        old_value != nil && !new_value_before_type_cast.is_a?(::Numeric) &&
         
     | 
| 
      
 42 
     | 
    
         
            +
                          non_numeric_string?(new_value_before_type_cast.to_s)
         
     | 
| 
       42 
43 
     | 
    
         
             
                      end
         
     | 
| 
       43 
44 
     | 
    
         | 
| 
       44 
45 
     | 
    
         
             
                      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,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: activemodel
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 7.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 7.0.9
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - David Heinemeier Hansson
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire: 
         
     | 
| 
       9 
8 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
9 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 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.0. 
     | 
| 
      
 18 
     | 
    
         
            +
                    version: 7.0.9
         
     | 
| 
       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.0. 
     | 
| 
      
 25 
     | 
    
         
            +
                    version: 7.0.9
         
     | 
| 
       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.
         
     | 
| 
         @@ -107,12 +106,11 @@ licenses: 
     | 
|
| 
       107 
106 
     | 
    
         
             
            - MIT
         
     | 
| 
       108 
107 
     | 
    
         
             
            metadata:
         
     | 
| 
       109 
108 
     | 
    
         
             
              bug_tracker_uri: https://github.com/rails/rails/issues
         
     | 
| 
       110 
     | 
    
         
            -
              changelog_uri: https://github.com/rails/rails/blob/v7.0. 
     | 
| 
       111 
     | 
    
         
            -
              documentation_uri: https://api.rubyonrails.org/v7.0. 
     | 
| 
      
 109 
     | 
    
         
            +
              changelog_uri: https://github.com/rails/rails/blob/v7.0.9/activemodel/CHANGELOG.md
         
     | 
| 
      
 110 
     | 
    
         
            +
              documentation_uri: https://api.rubyonrails.org/v7.0.9/
         
     | 
| 
       112 
111 
     | 
    
         
             
              mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
         
     | 
| 
       113 
     | 
    
         
            -
              source_code_uri: https://github.com/rails/rails/tree/v7.0. 
     | 
| 
      
 112 
     | 
    
         
            +
              source_code_uri: https://github.com/rails/rails/tree/v7.0.9/activemodel
         
     | 
| 
       114 
113 
     | 
    
         
             
              rubygems_mfa_required: 'true'
         
     | 
| 
       115 
     | 
    
         
            -
            post_install_message: 
         
     | 
| 
       116 
114 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       117 
115 
     | 
    
         
             
            require_paths:
         
     | 
| 
       118 
116 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -127,8 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       127 
125 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       128 
126 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       129 
127 
     | 
    
         
             
            requirements: []
         
     | 
| 
       130 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
       131 
     | 
    
         
            -
            signing_key: 
         
     | 
| 
      
 128 
     | 
    
         
            +
            rubygems_version: 3.6.9
         
     | 
| 
       132 
129 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       133 
130 
     | 
    
         
             
            summary: A toolkit for building modeling frameworks (part of Rails).
         
     | 
| 
       134 
131 
     | 
    
         
             
            test_files: []
         
     |