Skip to content

Commit be77bc5

Browse files
rosstonledermann
andcommitted
Use #lease_connection instead of #connection in Rails 7.2
Co-authored-by: Georg Ledermann <[email protected]>
1 parent d467efc commit be77bc5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/cypress-rails/manages_transactions.rb

+8-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@ def initialize
5555
def gather_connections
5656
setup_shared_connection_pool
5757

58-
ActiveRecord::Base.connection_handler.connection_pool_list.map(&:connection)
58+
ActiveRecord::Base.connection_handler.connection_pool_list.map do |pool|
59+
# Rails 7.2+
60+
if pool.respond_to?(:lease_connection)
61+
pool.lease_connection
62+
else
63+
pool.connection
64+
end
65+
end
5966
end
6067

6168
# Shares the writing connection pool with connections on

0 commit comments

Comments
 (0)