activemodel 6.1.4.6 → 6.1.6.1
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 +50 -0
- data/MIT-LICENSE +1 -2
- data/lib/active_model/attribute_set/builder.rb +1 -1
- data/lib/active_model/dirty.rb +1 -1
- data/lib/active_model/errors.rb +3 -3
- data/lib/active_model/gem_version.rb +2 -2
- data/lib/active_model/secure_password.rb +1 -0
- data/lib/active_model/type/registry.rb +7 -9
- data/lib/active_model/type.rb +3 -2
- data/lib/active_model.rb +1 -1
- metadata +9 -8
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: ae24a33b1bbfa6eb1e4c5e55f14a7bb92631f3c16b894fe516e01507f3a3354f
         | 
| 4 | 
            +
              data.tar.gz: fa7badebe0d2d6213db0e1122bb94fbff72cbc11fe1e8bce870ed1b340a8f31b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: dd715570f3cba8ebe323210ac537b2ca5852cf1827cd791cd8b023f01d848047d0b0e52d205a99a49f310ea81fb9accbc404de5d7d53f2c629a83cd7a5ae7d7f
         | 
| 7 | 
            +
              data.tar.gz: 80284508ce715c8335715acff27814c89e40036d2c107f3684cf97741a50e7cc188b25636ee5c3f01ea4ec0c74c34367aa4eb3daa1ebc7a93ad2946c568670a9
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,49 @@ | |
| 1 | 
            +
            ## Rails 6.1.6.1 (July 12, 2022) ##
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            *   No changes.
         | 
| 4 | 
            +
             | 
| 5 | 
            +
             | 
| 6 | 
            +
            ## Rails 6.1.5.1 (April 26, 2022) ##
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            *   No changes.
         | 
| 9 | 
            +
             | 
| 10 | 
            +
             | 
| 11 | 
            +
            ## Rails 6.1.5 (March 09, 2022) ##
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            *   Clear secure password cache if password is set to `nil`
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                Before:
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                   user.password = 'something'
         | 
| 18 | 
            +
                   user.password = nil
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                   user.password # => 'something'
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                Now:
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                   user.password = 'something'
         | 
| 25 | 
            +
                   user.password = nil
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                   user.password # => nil
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                *Markus Doits*
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            *   Fix delegation in `ActiveModel::Type::Registry#lookup` and `ActiveModel::Type.lookup`
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                Passing a last positional argument `{}` would be incorrectly considered as keyword argument.
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                *Benoit Daloze*
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            *   Fix `to_json` after `changes_applied` for `ActiveModel::Dirty` object.
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                *Ryuta Kamizono*
         | 
| 40 | 
            +
             | 
| 41 | 
            +
             | 
| 42 | 
            +
            ## Rails 6.1.4.7 (March 08, 2022) ##
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            *   No changes.
         | 
| 45 | 
            +
             | 
| 46 | 
            +
             | 
| 1 47 | 
             
            ## Rails 6.1.4.6 (February 11, 2022) ##
         | 
| 2 48 |  | 
| 3 49 | 
             
            *   No changes.
         | 
| @@ -123,6 +169,10 @@ | |
| 123 169 | 
             
                some edge cases won’t be covered, like `errors#first` will return `ActiveModel::Error` and manipulating
         | 
| 124 170 | 
             
                `errors.messages` and `errors.details` hashes directly will have no effect. Moving forward,
         | 
| 125 171 | 
             
                please convert those direct manipulations to use provided API methods instead.
         | 
| 172 | 
            +
                Please note that `errors#add` now accepts `options` as keyword arguments instead of `Hash` which
         | 
| 173 | 
            +
                introduced a change in Ruby 3 to [keyword arguments][kwargs-ann].
         | 
| 174 | 
            +
             | 
| 175 | 
            +
                [kwargs-ann]: https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
         | 
| 126 176 |  | 
| 127 177 | 
             
                The list of deprecated methods and their planned future behavioral changes at the next major release are:
         | 
| 128 178 |  | 
    
        data/MIT-LICENSE
    CHANGED
    
    | @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            Copyright (c) 2004- | 
| 1 | 
            +
            Copyright (c) 2004-2022 David Heinemeier Hansson
         | 
| 2 2 |  | 
| 3 3 | 
             
            Permission is hereby granted, free of charge, to any person obtaining
         | 
| 4 4 | 
             
            a copy of this software and associated documentation files (the
         | 
| @@ -18,4 +18,3 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
| 18 18 | 
             
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         | 
| 19 19 | 
             
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         | 
| 20 20 | 
             
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
| 21 | 
            -
             | 
| @@ -146,7 +146,7 @@ module ActiveModel | |
| 146 146 | 
             
                def marshal_load(values)
         | 
| 147 147 | 
             
                  if values.is_a?(Hash)
         | 
| 148 148 | 
             
                    ActiveSupport::Deprecation.warn(<<~MSG)
         | 
| 149 | 
            -
                      Marshalling load from legacy attributes format is deprecated and will be removed in Rails  | 
| 149 | 
            +
                      Marshalling load from legacy attributes format is deprecated and will be removed in Rails 7.0.
         | 
| 150 150 | 
             
                    MSG
         | 
| 151 151 | 
             
                    empty_hash = {}.freeze
         | 
| 152 152 | 
             
                    initialize(empty_hash, empty_hash, empty_hash, empty_hash, values)
         | 
    
        data/lib/active_model/dirty.rb
    CHANGED
    
    | @@ -140,7 +140,7 @@ module ActiveModel | |
| 140 140 | 
             
                end
         | 
| 141 141 |  | 
| 142 142 | 
             
                def as_json(options = {}) # :nodoc:
         | 
| 143 | 
            -
                  options[:except] = [options[:except], "mutations_from_database"] | 
| 143 | 
            +
                  options[:except] = [*options[:except], "mutations_from_database", "mutations_before_last_save"]
         | 
| 144 144 | 
             
                  super(options)
         | 
| 145 145 | 
             
                end
         | 
| 146 146 |  | 
    
        data/lib/active_model/errors.rb
    CHANGED
    
    | @@ -249,7 +249,7 @@ module ActiveModel | |
| 249 249 |  | 
| 250 250 | 
             
                      You are passing a block expecting two parameters,
         | 
| 251 251 | 
             
                      so the old hash behavior is simulated. As this is deprecated,
         | 
| 252 | 
            -
                      this will result in an ArgumentError in Rails  | 
| 252 | 
            +
                      this will result in an ArgumentError in Rails 7.0.
         | 
| 253 253 | 
             
                    MSG
         | 
| 254 254 | 
             
                    @errors.
         | 
| 255 255 | 
             
                      sort { |a, b| a.attribute <=> b.attribute }.
         | 
| @@ -325,7 +325,7 @@ module ActiveModel | |
| 325 325 |  | 
| 326 326 | 
             
                def to_h
         | 
| 327 327 | 
             
                  ActiveSupport::Deprecation.warn(<<~EOM)
         | 
| 328 | 
            -
                    ActiveModel::Errors#to_h is deprecated and will be removed in Rails  | 
| 328 | 
            +
                    ActiveModel::Errors#to_h is deprecated and will be removed in Rails 7.0.
         | 
| 329 329 | 
             
                    Please use `ActiveModel::Errors.to_hash` instead. The values in the hash
         | 
| 330 330 | 
             
                    returned by `ActiveModel::Errors.to_hash` is an array of error messages.
         | 
| 331 331 | 
             
                  EOM
         | 
| @@ -583,7 +583,7 @@ module ActiveModel | |
| 583 583 | 
             
                  end
         | 
| 584 584 |  | 
| 585 585 | 
             
                  def deprecation_removal_warning(method_name, alternative_message = nil)
         | 
| 586 | 
            -
                    message = +"ActiveModel::Errors##{method_name} is deprecated and will be removed in Rails  | 
| 586 | 
            +
                    message = +"ActiveModel::Errors##{method_name} is deprecated and will be removed in Rails 7.0."
         | 
| 587 587 | 
             
                    if alternative_message
         | 
| 588 588 | 
             
                      message << "\n\nTo achieve the same use:\n\n  "
         | 
| 589 589 | 
             
                      message << alternative_message
         | 
| @@ -94,6 +94,7 @@ module ActiveModel | |
| 94 94 |  | 
| 95 95 | 
             
                    define_method("#{attribute}=") do |unencrypted_password|
         | 
| 96 96 | 
             
                      if unencrypted_password.nil?
         | 
| 97 | 
            +
                        instance_variable_set("@#{attribute}", nil)
         | 
| 97 98 | 
             
                        self.public_send("#{attribute}_digest=", nil)
         | 
| 98 99 | 
             
                      elsif !unencrypted_password.empty?
         | 
| 99 100 | 
             
                        instance_variable_set("@#{attribute}", unencrypted_password)
         | 
| @@ -21,15 +21,16 @@ module ActiveModel | |
| 21 21 | 
             
                    registrations << registration_klass.new(type_name, block, **options)
         | 
| 22 22 | 
             
                  end
         | 
| 23 23 |  | 
| 24 | 
            -
                  def lookup(symbol, *args | 
| 25 | 
            -
                    registration = find_registration(symbol, *args | 
| 24 | 
            +
                  def lookup(symbol, *args)
         | 
| 25 | 
            +
                    registration = find_registration(symbol, *args)
         | 
| 26 26 |  | 
| 27 27 | 
             
                    if registration
         | 
| 28 | 
            -
                      registration.call(self, symbol, *args | 
| 28 | 
            +
                      registration.call(self, symbol, *args)
         | 
| 29 29 | 
             
                    else
         | 
| 30 30 | 
             
                      raise ArgumentError, "Unknown type #{symbol.inspect}"
         | 
| 31 31 | 
             
                    end
         | 
| 32 32 | 
             
                  end
         | 
| 33 | 
            +
                  ruby2_keywords(:lookup) if respond_to?(:ruby2_keywords, true)
         | 
| 33 34 |  | 
| 34 35 | 
             
                  private
         | 
| 35 36 | 
             
                    attr_reader :registrations
         | 
| @@ -50,13 +51,10 @@ module ActiveModel | |
| 50 51 | 
             
                    @block = block
         | 
| 51 52 | 
             
                  end
         | 
| 52 53 |  | 
| 53 | 
            -
                  def call(_registry, *args | 
| 54 | 
            -
                     | 
| 55 | 
            -
                      block.call(*args, **kwargs)
         | 
| 56 | 
            -
                    else
         | 
| 57 | 
            -
                      block.call(*args)
         | 
| 58 | 
            -
                    end
         | 
| 54 | 
            +
                  def call(_registry, *args)
         | 
| 55 | 
            +
                    block.call(*args)
         | 
| 59 56 | 
             
                  end
         | 
| 57 | 
            +
                  ruby2_keywords(:call) if respond_to?(:ruby2_keywords, true)
         | 
| 60 58 |  | 
| 61 59 | 
             
                  def matches?(type_name, *args, **kwargs)
         | 
| 62 60 | 
             
                    type_name == name
         | 
    
        data/lib/active_model/type.rb
    CHANGED
    
    | @@ -29,9 +29,10 @@ module ActiveModel | |
| 29 29 | 
             
                    registry.register(type_name, klass, **options, &block)
         | 
| 30 30 | 
             
                  end
         | 
| 31 31 |  | 
| 32 | 
            -
                  def lookup(*args | 
| 33 | 
            -
                    registry.lookup(*args | 
| 32 | 
            +
                  def lookup(*args) # :nodoc:
         | 
| 33 | 
            +
                    registry.lookup(*args)
         | 
| 34 34 | 
             
                  end
         | 
| 35 | 
            +
                  ruby2_keywords(:lookup) if respond_to?(:ruby2_keywords, true)
         | 
| 35 36 |  | 
| 36 37 | 
             
                  def default_value # :nodoc:
         | 
| 37 38 | 
             
                    @default_value ||= Value.new
         | 
    
        data/lib/active_model.rb
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            #--
         | 
| 4 | 
            -
            # Copyright (c) 2004- | 
| 4 | 
            +
            # Copyright (c) 2004-2022 David Heinemeier Hansson
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining
         | 
| 7 7 | 
             
            # a copy of this software and associated documentation files (the
         | 
    
        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: 6.1. | 
| 4 | 
            +
              version: 6.1.6.1
         | 
| 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: 2022- | 
| 11 | 
            +
            date: 2022-07-12 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: 6.1. | 
| 19 | 
            +
                    version: 6.1.6.1
         | 
| 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: 6.1. | 
| 26 | 
            +
                    version: 6.1.6.1
         | 
| 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.
         | 
| @@ -104,10 +104,11 @@ licenses: | |
| 104 104 | 
             
            - MIT
         | 
| 105 105 | 
             
            metadata:
         | 
| 106 106 | 
             
              bug_tracker_uri: https://github.com/rails/rails/issues
         | 
| 107 | 
            -
              changelog_uri: https://github.com/rails/rails/blob/v6.1. | 
| 108 | 
            -
              documentation_uri: https://api.rubyonrails.org/v6.1. | 
| 107 | 
            +
              changelog_uri: https://github.com/rails/rails/blob/v6.1.6.1/activemodel/CHANGELOG.md
         | 
| 108 | 
            +
              documentation_uri: https://api.rubyonrails.org/v6.1.6.1/
         | 
| 109 109 | 
             
              mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
         | 
| 110 | 
            -
              source_code_uri: https://github.com/rails/rails/tree/v6.1. | 
| 110 | 
            +
              source_code_uri: https://github.com/rails/rails/tree/v6.1.6.1/activemodel
         | 
| 111 | 
            +
              rubygems_mfa_required: 'true'
         | 
| 111 112 | 
             
            post_install_message:
         | 
| 112 113 | 
             
            rdoc_options: []
         | 
| 113 114 | 
             
            require_paths:
         | 
| @@ -123,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 123 124 | 
             
                - !ruby/object:Gem::Version
         | 
| 124 125 | 
             
                  version: '0'
         | 
| 125 126 | 
             
            requirements: []
         | 
| 126 | 
            -
            rubygems_version: 3. | 
| 127 | 
            +
            rubygems_version: 3.3.3
         | 
| 127 128 | 
             
            signing_key:
         | 
| 128 129 | 
             
            specification_version: 4
         | 
| 129 130 | 
             
            summary: A toolkit for building modeling frameworks (part of Rails).
         |