activerecord 7.1.5.1 → 7.1.6
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 +42 -0
- data/lib/active_record/attribute_methods.rb +20 -15
- data/lib/active_record/connection_adapters/abstract_adapter.rb +10 -3
- data/lib/active_record/connection_adapters/mysql/quoting.rb +7 -1
- data/lib/active_record/core.rb +1 -1
- data/lib/active_record/gem_version.rb +2 -2
- data/lib/active_record/relation/finder_methods.rb +4 -3
- metadata +10 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f3204f7f0cb9d1d71ab7642643724921e6c942f4f7c99beeae9ac49342f70ed7
|
|
4
|
+
data.tar.gz: 47c12eb7710323f64881e54ac05b70cbf6e365f7559c52579c295e6c35b2b547
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d2807f2124023b0b00d632ad9dc46c5eabd404e35fd7f75a46eb285f9875455c7444b9c059c437fef31bcc3d6694779e19cffa69ce5be81139af959ca86c8490
|
|
7
|
+
data.tar.gz: ea070b99aaacc7b369b8daed1256cae97f6d81f452698900c8fa25dc3f243af1900599b457b7461b2d544ff00b69e1b9b850bcf02e40b73e7581cf1abce8796f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
+
## Rails 7.1.6 (October 28, 2025) ##
|
|
2
|
+
|
|
3
|
+
* Gracefully handle `Timeout.timeout` firing during connection configuration.
|
|
4
|
+
|
|
5
|
+
Use of `Timeout.timeout` could result in improperly initialized database connection.
|
|
6
|
+
|
|
7
|
+
This could lead to a partially configured connection being used, resulting in various exceptions,
|
|
8
|
+
the most common being with the PostgreSQLAdapter raising `undefined method `key?' for nil`
|
|
9
|
+
or `TypeError: wrong argument type nil (expected PG::TypeMap)`.
|
|
10
|
+
|
|
11
|
+
*Jean Boussier*
|
|
12
|
+
|
|
13
|
+
* Fix error handling during connection configuration.
|
|
14
|
+
|
|
15
|
+
Active Record wasn't properly handling errors during the connection configuration phase.
|
|
16
|
+
This could lead to a partially configured connection being used, resulting in various exceptions,
|
|
17
|
+
the most common being with the PostgreSQLAdapter raising `undefined method `key?' for nil`
|
|
18
|
+
or `TypeError: wrong argument type nil (expected PG::TypeMap)`.
|
|
19
|
+
|
|
20
|
+
*Jean Boussier*
|
|
21
|
+
|
|
22
|
+
* Fix prepared statements on mysql2 adapter.
|
|
23
|
+
|
|
24
|
+
*Jean Boussier*
|
|
25
|
+
|
|
26
|
+
* Fix a race condition in `ActiveRecord::Base#method_missing` when lazily defining attributes.
|
|
27
|
+
|
|
28
|
+
If multiple thread were concurrently triggering attribute definition on the same model,
|
|
29
|
+
it could result in a `NoMethodError` being raised.
|
|
30
|
+
|
|
31
|
+
*Jean Boussier*
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## Rails 7.1.5.2 (August 13, 2025) ##
|
|
35
|
+
|
|
36
|
+
* Call inspect on ids in RecordNotFound error
|
|
37
|
+
|
|
38
|
+
[CVE-2025-55193]
|
|
39
|
+
|
|
40
|
+
*Gannon McGibbon*, *John Hawthorn*
|
|
41
|
+
|
|
42
|
+
|
|
1
43
|
## Rails 7.1.5.1 (December 10, 2024) ##
|
|
2
44
|
|
|
3
45
|
* No changes.
|
|
@@ -138,6 +138,7 @@ module ActiveRecord
|
|
|
138
138
|
super(attribute_names)
|
|
139
139
|
@attribute_methods_generated = true
|
|
140
140
|
end
|
|
141
|
+
|
|
141
142
|
true
|
|
142
143
|
end
|
|
143
144
|
|
|
@@ -480,23 +481,27 @@ module ActiveRecord
|
|
|
480
481
|
end
|
|
481
482
|
|
|
482
483
|
def method_missing(name, ...)
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
# Some attribute methods weren't generated yet, we retry the call
|
|
495
|
-
return public_send(name, ...)
|
|
496
|
-
end
|
|
484
|
+
# We can't know whether some method was defined or not because
|
|
485
|
+
# multiple thread might be concurrently be in this code path.
|
|
486
|
+
# So the first one would define the methods and the others would
|
|
487
|
+
# appear to already have them.
|
|
488
|
+
self.class.define_attribute_methods
|
|
489
|
+
|
|
490
|
+
# So in all cases we must behave as if the method was just defined.
|
|
491
|
+
method = begin
|
|
492
|
+
self.class.public_instance_method(name)
|
|
493
|
+
rescue NameError
|
|
494
|
+
nil
|
|
497
495
|
end
|
|
498
496
|
|
|
499
|
-
|
|
497
|
+
# The method might be explicitly defined in the model, but call a generated
|
|
498
|
+
# method with super. So we must resume the call chain at the right step.
|
|
499
|
+
method = method.super_method while method && !method.owner.is_a?(GeneratedAttributeMethods)
|
|
500
|
+
if method
|
|
501
|
+
method.bind_call(self, ...)
|
|
502
|
+
else
|
|
503
|
+
super
|
|
504
|
+
end
|
|
500
505
|
end
|
|
501
506
|
|
|
502
507
|
def attribute_method?(attr_name)
|
|
@@ -690,7 +690,7 @@ module ActiveRecord
|
|
|
690
690
|
|
|
691
691
|
reset_transaction(restore: restore_transactions) do
|
|
692
692
|
clear_cache!(new_connection: true)
|
|
693
|
-
|
|
693
|
+
attempt_configure_connection
|
|
694
694
|
end
|
|
695
695
|
rescue => original_exception
|
|
696
696
|
translated_exception = translate_exception_class(original_exception, nil, nil)
|
|
@@ -742,7 +742,7 @@ module ActiveRecord
|
|
|
742
742
|
def reset!
|
|
743
743
|
clear_cache!(new_connection: true)
|
|
744
744
|
reset_transaction
|
|
745
|
-
|
|
745
|
+
attempt_configure_connection
|
|
746
746
|
end
|
|
747
747
|
|
|
748
748
|
# Removes the connection from the pool and disconnect it.
|
|
@@ -778,7 +778,7 @@ module ActiveRecord
|
|
|
778
778
|
if @unconfigured_connection
|
|
779
779
|
@raw_connection = @unconfigured_connection
|
|
780
780
|
@unconfigured_connection = nil
|
|
781
|
-
|
|
781
|
+
attempt_configure_connection
|
|
782
782
|
@verified = true
|
|
783
783
|
return
|
|
784
784
|
end
|
|
@@ -1225,6 +1225,13 @@ module ActiveRecord
|
|
|
1225
1225
|
def configure_connection
|
|
1226
1226
|
end
|
|
1227
1227
|
|
|
1228
|
+
def attempt_configure_connection
|
|
1229
|
+
configure_connection
|
|
1230
|
+
rescue Exception # Need to handle things such as Timeout::ExitException
|
|
1231
|
+
disconnect!
|
|
1232
|
+
raise
|
|
1233
|
+
end
|
|
1234
|
+
|
|
1228
1235
|
def default_prepared_statements
|
|
1229
1236
|
true
|
|
1230
1237
|
end
|
data/lib/active_record/core.rb
CHANGED
|
@@ -250,7 +250,7 @@ module ActiveRecord
|
|
|
250
250
|
return super if StatementCache.unsupported_value?(id)
|
|
251
251
|
|
|
252
252
|
cached_find_by([primary_key], [id]) ||
|
|
253
|
-
raise(RecordNotFound.new("Couldn't find #{name} with '#{primary_key}'=#{id}", name, primary_key, id))
|
|
253
|
+
raise(RecordNotFound.new("Couldn't find #{name} with '#{primary_key}'=#{id.inspect}", name, primary_key, id))
|
|
254
254
|
end
|
|
255
255
|
|
|
256
256
|
def find_by(*args) # :nodoc:
|
|
@@ -412,12 +412,13 @@ module ActiveRecord
|
|
|
412
412
|
error << " with#{conditions}" if conditions
|
|
413
413
|
raise RecordNotFound.new(error, name, key)
|
|
414
414
|
elsif Array.wrap(ids).size == 1
|
|
415
|
-
|
|
415
|
+
id = Array.wrap(ids)[0]
|
|
416
|
+
error = "Couldn't find #{name} with '#{key}'=#{id.inspect}#{conditions}"
|
|
416
417
|
raise RecordNotFound.new(error, name, key, ids)
|
|
417
418
|
else
|
|
418
419
|
error = +"Couldn't find all #{name.pluralize} with '#{key}': "
|
|
419
|
-
error << "(#{ids.join(", ")})#{conditions} (found #{result_size} results, but was looking for #{expected_size})."
|
|
420
|
-
error << " Couldn't find #{name.pluralize(not_found_ids.size)} with #{key.to_s.pluralize(not_found_ids.size)} #{not_found_ids.join(', ')}." if not_found_ids
|
|
420
|
+
error << "(#{ids.map(&:inspect).join(", ")})#{conditions} (found #{result_size} results, but was looking for #{expected_size})."
|
|
421
|
+
error << " Couldn't find #{name.pluralize(not_found_ids.size)} with #{key.to_s.pluralize(not_found_ids.size)} #{not_found_ids.map(&:inspect).join(', ')}." if not_found_ids
|
|
421
422
|
raise RecordNotFound.new(error, name, key, ids)
|
|
422
423
|
end
|
|
423
424
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activerecord
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.1.
|
|
4
|
+
version: 7.1.6
|
|
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,28 +15,28 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - '='
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 7.1.
|
|
18
|
+
version: 7.1.6
|
|
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.1.
|
|
25
|
+
version: 7.1.6
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
27
|
name: activemodel
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
30
|
- - '='
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 7.1.
|
|
32
|
+
version: 7.1.6
|
|
34
33
|
type: :runtime
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
37
|
- - '='
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 7.1.
|
|
39
|
+
version: 7.1.6
|
|
41
40
|
- !ruby/object:Gem::Dependency
|
|
42
41
|
name: timeout
|
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -470,12 +469,11 @@ licenses:
|
|
|
470
469
|
- MIT
|
|
471
470
|
metadata:
|
|
472
471
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
|
473
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.1.
|
|
474
|
-
documentation_uri: https://api.rubyonrails.org/v7.1.
|
|
472
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.1.6/activerecord/CHANGELOG.md
|
|
473
|
+
documentation_uri: https://api.rubyonrails.org/v7.1.6/
|
|
475
474
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
|
476
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.1.
|
|
475
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.1.6/activerecord
|
|
477
476
|
rubygems_mfa_required: 'true'
|
|
478
|
-
post_install_message:
|
|
479
477
|
rdoc_options:
|
|
480
478
|
- "--main"
|
|
481
479
|
- README.rdoc
|
|
@@ -492,8 +490,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
492
490
|
- !ruby/object:Gem::Version
|
|
493
491
|
version: '0'
|
|
494
492
|
requirements: []
|
|
495
|
-
rubygems_version: 3.
|
|
496
|
-
signing_key:
|
|
493
|
+
rubygems_version: 3.6.9
|
|
497
494
|
specification_version: 4
|
|
498
495
|
summary: Object-relational mapper framework (part of Rails).
|
|
499
496
|
test_files: []
|