activemodel 6.1.4.7 → 6.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d156ed41186e34927be115d635558f84ca15bb7b42db1be1d83ddbee45d0a8d
4
- data.tar.gz: f056e2870b3103a63365f2be56af31307505b7e29b75f48d9ec4fe44ef621e0a
3
+ metadata.gz: fa1374c8ad08249d841d95a4cb181adfba7603e7db398ad5acc1d469cc651d4b
4
+ data.tar.gz: 781c692d2d1bdcb09ab8b9958b25be20826bcd720814142f74d62cb3bd617466
5
5
  SHA512:
6
- metadata.gz: 9cfae9c85b3bb3c12e039eb5c4ff36635eda2f53718c29bb2d58299c77a85ef4d8fea7dfdafd8950a92fb242c40549762001ea9850b4586f8bf0b85932c3774b
7
- data.tar.gz: 78ad4a85c901ed779050a42a7df607e65c9eb708273f38cfe42f5d273834ccd644a499f51221fdd00b0272eb93e28d60b56915e80bc8ab5d77ac03ab20dca32e
6
+ metadata.gz: cf65a865cd62f0b68ec5e12548cfef4c51463dc1985b9452994eaaad934e21f9d1f148cdd8409d15e3b489fffd4dd052263dd640db74d066b45d88f3da75a083
7
+ data.tar.gz: 9ad9756a581ccb6c76b6973778d9a9352f245b3a450687456ab03747f949ad1afa8b727f85d13b51115cbcc24f281bb641af78a2238a2f5089885d5a4e0d6f24
data/CHANGELOG.md CHANGED
@@ -1,3 +1,34 @@
1
+ ## Rails 6.1.5 (March 09, 2022) ##
2
+
3
+ * Clear secure password cache if password is set to `nil`
4
+
5
+ Before:
6
+
7
+ user.password = 'something'
8
+ user.password = nil
9
+
10
+ user.password # => 'something'
11
+
12
+ Now:
13
+
14
+ user.password = 'something'
15
+ user.password = nil
16
+
17
+ user.password # => nil
18
+
19
+ *Markus Doits*
20
+
21
+ * Fix delegation in `ActiveModel::Type::Registry#lookup` and `ActiveModel::Type.lookup`
22
+
23
+ Passing a last positional argument `{}` would be incorrectly considered as keyword argument.
24
+
25
+ *Benoit Daloze*
26
+
27
+ * Fix `to_json` after `changes_applied` for `ActiveModel::Dirty` object.
28
+
29
+ *Ryuta Kamizono*
30
+
31
+
1
32
  ## Rails 6.1.4.7 (March 08, 2022) ##
2
33
 
3
34
  * No changes.
@@ -128,6 +159,10 @@
128
159
  some edge cases won’t be covered, like `errors#first` will return `ActiveModel::Error` and manipulating
129
160
  `errors.messages` and `errors.details` hashes directly will have no effect. Moving forward,
130
161
  please convert those direct manipulations to use provided API methods instead.
162
+ Please note that `errors#add` now accepts `options` as keyword arguments instead of `Hash` which
163
+ introduced a change in Ruby 3 to [keyword arguments][kwargs-ann].
164
+
165
+ [kwargs-ann]: https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
131
166
 
132
167
  The list of deprecated methods and their planned future behavioral changes at the next major release are:
133
168
 
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2004-2020 David Heinemeier Hansson
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 6.2.
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)
@@ -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"].flatten
143
+ options[:except] = [*options[:except], "mutations_from_database", "mutations_before_last_save"]
144
144
  super(options)
145
145
  end
146
146
 
@@ -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 6.2.
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 6.2.
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 6.2."
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
@@ -9,8 +9,8 @@ module ActiveModel
9
9
  module VERSION
10
10
  MAJOR = 6
11
11
  MINOR = 1
12
- TINY = 4
13
- PRE = "7"
12
+ TINY = 5
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -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, **kwargs)
25
- registration = find_registration(symbol, *args, **kwargs)
24
+ def lookup(symbol, *args)
25
+ registration = find_registration(symbol, *args)
26
26
 
27
27
  if registration
28
- registration.call(self, symbol, *args, **kwargs)
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, **kwargs)
54
- if kwargs.any? # https://bugs.ruby-lang.org/issues/10856
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
@@ -29,9 +29,10 @@ module ActiveModel
29
29
  registry.register(type_name, klass, **options, &block)
30
30
  end
31
31
 
32
- def lookup(*args, **kwargs) # :nodoc:
33
- registry.lookup(*args, **kwargs)
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-2020 David Heinemeier Hansson
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.7
4
+ version: 6.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-08 00:00:00.000000000 Z
11
+ date: 2022-03-10 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.4.7
19
+ version: 6.1.5
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.4.7
26
+ version: 6.1.5
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,11 +104,12 @@ 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.4.7/activemodel/CHANGELOG.md
108
- documentation_uri: https://api.rubyonrails.org/v6.1.4.7/
107
+ changelog_uri: https://github.com/rails/rails/blob/v6.1.5/activemodel/CHANGELOG.md
108
+ documentation_uri: https://api.rubyonrails.org/v6.1.5/
109
109
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
110
- source_code_uri: https://github.com/rails/rails/tree/v6.1.4.7/activemodel
111
- post_install_message:
110
+ source_code_uri: https://github.com/rails/rails/tree/v6.1.5/activemodel
111
+ rubygems_mfa_required: 'true'
112
+ post_install_message:
112
113
  rdoc_options: []
113
114
  require_paths:
114
115
  - lib
@@ -123,8 +124,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
124
  - !ruby/object:Gem::Version
124
125
  version: '0'
125
126
  requirements: []
126
- rubygems_version: 3.1.6
127
- signing_key:
127
+ rubygems_version: 3.3.7
128
+ signing_key:
128
129
  specification_version: 4
129
130
  summary: A toolkit for building modeling frameworks (part of Rails).
130
131
  test_files: []