activerecord 7.2.3.2 → 7.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f0b33d440e108cfdd48cd307cff3cd3b11c672f0075bf7afcdc5db471ba6a51
4
- data.tar.gz: e28ccb24bbacf8e94e02dbede924f5a1ae2d5c347c3477376a10104e6bad8f08
3
+ metadata.gz: 9ca0e92f7516e74f6393987514991a58dae12fe1b3d82397c7f3ca7028ed9f1a
4
+ data.tar.gz: ce811baf51174bcb5044b1ad8b0ed3a2617c88f5fd464c2862d9c1dfc2825e10
5
5
  SHA512:
6
- metadata.gz: d2284fe1c731bd91ac4cbb71fb95bdddebe920baf6bc9c2f45ebd1b611f261d015c96b8a99a32e0e22a4f8574dc3e825b3ca54b446958150c8ff9f5777281bcf
7
- data.tar.gz: 4c151a8659c6abbec87f60b59f9ab7c8f024a446d77b9b5aa88de11b31307427de273cc785ffe1b5c62c3de805f124f348dc126bee7f6ec0d477ccd0b279264d
6
+ metadata.gz: 7af3db1746d508e87c26e4bb54b19d95944aa267259f1fbb9a230417ae50a913561a38ce1fc96861916d5b0d520bbf1b2791c71b8c28f47921a46c1e12b42710
7
+ data.tar.gz: 3c60bb8c726c6e3d25218ad0e701a9e9aa209c5d24042f224176f08411677c69e09379735ece0ba96b976b0d3a94d5e1716155494572fa75252ca2eb31de78a3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,37 @@
1
+ ## Rails 7.2.4 (September 24, 2026) ##
2
+
3
+ * Fix performance regression in `method_missing` for virtual SELECT alias
4
+ attributes.
5
+
6
+ Fixes #57183.
7
+
8
+ *Hammad Khan*
9
+
10
+ * Fix support for table names containing hyphens.
11
+
12
+ *Evgeniy Demin*
13
+
14
+ * Improve PostgreSQLAdapter resilience to Timeout.timeout.
15
+
16
+ Better handle asynchronous exceptions being thrown inside
17
+ the `reconnect!` method.
18
+
19
+ This may fixes some deep errors such as:
20
+
21
+ ```
22
+ undefined method `key?' for nil:NilClass (NoMethodError)
23
+ if !type_map.key?(oid)
24
+ ```
25
+
26
+ *Jean Boussier*
27
+
28
+ * Fix `eager_load` when loading `has_many` assocations with composite primary keys.
29
+
30
+ This would result in some records being loaded multiple times.
31
+
32
+ *Martin-Alexander*
33
+
34
+
1
35
  ## Rails 7.2.3.2 (July 29, 2026) ##
2
36
 
3
37
  * No changes.
@@ -103,7 +103,7 @@ module ActiveRecord
103
103
  end
104
104
 
105
105
  def instantiate(result_set, strict_loading_value, &block)
106
- primary_key = aliases.column_alias(join_root, join_root.primary_key)
106
+ primary_key = Array(join_root.primary_key).map { |column| aliases.column_alias(join_root, column) }
107
107
 
108
108
  seen = Hash.new { |i, parent|
109
109
  i[parent] = Hash.new { |j, child_class|
@@ -141,7 +141,7 @@ module ActiveRecord
141
141
 
142
142
  message_bus.instrument("instantiation.active_record", payload) do
143
143
  result_set.each { |row_hash|
144
- parent_key = primary_key ? row_hash[primary_key] : row_hash
144
+ parent_key = primary_key.empty? ? row_hash : row_hash.values_at(*primary_key)
145
145
  parent = parents[parent_key] ||= join_root.instantiate(row_hash, column_aliases, column_types, &block)
146
146
  construct(parent, join_root, row_hash, seen, model_cache, strict_loading_value)
147
147
  }
@@ -480,10 +480,12 @@ module ActiveRecord
480
480
  self.class.define_attribute_methods
481
481
 
482
482
  # So in all cases we must behave as if the method was just defined.
483
- method = begin
484
- self.class.public_instance_method(name)
485
- rescue NameError
486
- nil
483
+ method = if self.class.public_method_defined?(name)
484
+ begin
485
+ self.class.public_instance_method(name)
486
+ rescue NameError
487
+ nil
488
+ end
487
489
  end
488
490
 
489
491
  # The method might be explicitly defined in the model, but call a generated
@@ -121,7 +121,7 @@ module ActiveRecord
121
121
  class ConnectionPool
122
122
  # Prior to 3.3.5, WeakKeyMap had a use after free bug
123
123
  # https://bugs.ruby-lang.org/issues/20688
124
- if ObjectSpace.const_defined?(:WeakKeyMap) && RUBY_VERSION >= "3.3.5"
124
+ if ObjectSpace.const_defined?(:WeakKeyMap) && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.3.5")
125
125
  WeakThreadKeyMap = ObjectSpace::WeakKeyMap
126
126
  else
127
127
  class WeakThreadKeyMap # :nodoc:
@@ -691,7 +691,7 @@ module ActiveRecord
691
691
  end
692
692
 
693
693
  def extract_table_ref_from_insert_sql(sql)
694
- if sql =~ /into\s("[A-Za-z0-9_."\[\]\s]+"|[A-Za-z0-9_."\[\]]+)\s*/im
694
+ if sql =~ /into\s("[-A-Za-z0-9_."\[\]\s]+"|[A-Za-z0-9_."\[\]]+)\s*/im
695
695
  $1.delete('"').strip
696
696
  end
697
697
  end
@@ -673,34 +673,33 @@ module ActiveRecord
673
673
  deadline = retry_deadline && Process.clock_gettime(Process::CLOCK_MONOTONIC) + retry_deadline
674
674
 
675
675
  @lock.synchronize do
676
- reconnect
676
+ attempt_configure_connection do
677
+ reconnect
677
678
 
678
- enable_lazy_transactions!
679
- @raw_connection_dirty = false
680
- @last_activity = Process.clock_gettime(Process::CLOCK_MONOTONIC)
681
- @verified = true
679
+ enable_lazy_transactions!
680
+ @raw_connection_dirty = false
681
+ @last_activity = Process.clock_gettime(Process::CLOCK_MONOTONIC)
682
+ @verified = true
682
683
 
683
- reset_transaction(restore: restore_transactions) do
684
- clear_cache!(new_connection: true)
685
- attempt_configure_connection
686
- end
687
- rescue => original_exception
688
- translated_exception = translate_exception_class(original_exception, nil, nil)
689
- retry_deadline_exceeded = deadline && deadline < Process.clock_gettime(Process::CLOCK_MONOTONIC)
684
+ reset_transaction(restore: restore_transactions) do
685
+ clear_cache!(new_connection: true)
686
+ configure_connection
687
+ end
688
+ rescue => original_exception
689
+ translated_exception = translate_exception_class(original_exception, nil, nil)
690
+ retry_deadline_exceeded = deadline && deadline < Process.clock_gettime(Process::CLOCK_MONOTONIC)
690
691
 
691
- if !retry_deadline_exceeded && retries_available > 0
692
- retries_available -= 1
692
+ if !retry_deadline_exceeded && retries_available > 0
693
+ retries_available -= 1
693
694
 
694
- if retryable_connection_error?(translated_exception)
695
- backoff(connection_retries - retries_available)
696
- retry
695
+ if retryable_connection_error?(translated_exception)
696
+ backoff(connection_retries - retries_available)
697
+ retry
698
+ end
697
699
  end
698
- end
699
-
700
- @last_activity = nil
701
- @verified = false
702
700
 
703
- raise translated_exception
701
+ raise translated_exception
702
+ end
704
703
  end
705
704
  end
706
705
 
@@ -708,6 +707,8 @@ module ActiveRecord
708
707
  # method does nothing.
709
708
  def disconnect!
710
709
  @lock.synchronize do
710
+ @last_activity = nil
711
+ @verified = false
711
712
  clear_cache!(new_connection: true)
712
713
  reset_transaction
713
714
  @raw_connection_dirty = false
@@ -733,9 +734,11 @@ module ActiveRecord
733
734
  # should call super immediately after resetting the connection (and while
734
735
  # still holding @lock).
735
736
  def reset!
736
- clear_cache!(new_connection: true)
737
- reset_transaction
738
- attempt_configure_connection
737
+ attempt_configure_connection do
738
+ clear_cache!(new_connection: true)
739
+ reset_transaction
740
+ configure_connection
741
+ end
739
742
  end
740
743
 
741
744
  # Removes the connection from the pool and disconnect it.
@@ -769,11 +772,13 @@ module ActiveRecord
769
772
  unless active?
770
773
  @lock.synchronize do
771
774
  if @unconfigured_connection
772
- @raw_connection = @unconfigured_connection
773
- @unconfigured_connection = nil
774
- attempt_configure_connection
775
- @last_activity = Process.clock_gettime(Process::CLOCK_MONOTONIC)
776
- @verified = true
775
+ attempt_configure_connection do
776
+ @raw_connection = @unconfigured_connection
777
+ @unconfigured_connection = nil
778
+ configure_connection
779
+ @last_activity = Process.clock_gettime(Process::CLOCK_MONOTONIC)
780
+ @verified = true
781
+ end
777
782
  return
778
783
  end
779
784
 
@@ -1228,7 +1233,7 @@ module ActiveRecord
1228
1233
  end
1229
1234
 
1230
1235
  def attempt_configure_connection
1231
- configure_connection
1236
+ yield
1232
1237
  rescue Exception # Need to handle things such as Timeout::ExitException
1233
1238
  disconnect!
1234
1239
  raise
@@ -9,8 +9,8 @@ module ActiveRecord
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 2
12
- TINY = 3
13
- PRE = "2"
12
+ TINY = 4
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.3.2
4
+ version: 7.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -15,28 +15,28 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 7.2.3.2
18
+ version: 7.2.4
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.3.2
25
+ version: 7.2.4
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: activemodel
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - '='
31
31
  - !ruby/object:Gem::Version
32
- version: 7.2.3.2
32
+ version: 7.2.4
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - '='
38
38
  - !ruby/object:Gem::Version
39
- version: 7.2.3.2
39
+ version: 7.2.4
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: timeout
42
42
  requirement: !ruby/object:Gem::Requirement
@@ -475,10 +475,10 @@ licenses:
475
475
  - MIT
476
476
  metadata:
477
477
  bug_tracker_uri: https://github.com/rails/rails/issues
478
- changelog_uri: https://github.com/rails/rails/blob/v7.2.3.2/activerecord/CHANGELOG.md
479
- documentation_uri: https://api.rubyonrails.org/v7.2.3.2/
478
+ changelog_uri: https://github.com/rails/rails/blob/v7.2.4/activerecord/CHANGELOG.md
479
+ documentation_uri: https://api.rubyonrails.org/v7.2.4/
480
480
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
481
- source_code_uri: https://github.com/rails/rails/tree/v7.2.3.2/activerecord
481
+ source_code_uri: https://github.com/rails/rails/tree/v7.2.4/activerecord
482
482
  rubygems_mfa_required: 'true'
483
483
  rdoc_options:
484
484
  - "--main"
@@ -496,7 +496,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
496
496
  - !ruby/object:Gem::Version
497
497
  version: '0'
498
498
  requirements: []
499
- rubygems_version: 4.0.16
499
+ rubygems_version: 4.0.20
500
500
  specification_version: 4
501
501
  summary: Object-relational mapper framework (part of Rails).
502
502
  test_files: []