Skip to content

Commit

Permalink
Use #lease_connection instead of #connection in Rails 7.2
Browse files Browse the repository at this point in the history
Taken from #165, hence
the coauthor credit.

Co-authored-by: Georg Ledermann <[email protected]>
  • Loading branch information
rosston and ledermann committed Sep 25, 2024
1 parent d467efc commit 67cf2bf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/cypress-rails/manages_transactions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ def initialize
def gather_connections
setup_shared_connection_pool

ActiveRecord::Base.connection_handler.connection_pool_list.map(&:connection)
ActiveRecord::Base.connection_handler.connection_pool_list.map do |pool|
# Rails 7.2+
if pool.respond_to?(:lease_connection)
pool.lease_connection
else
pool.connection
end
end
end

# Shares the writing connection pool with connections on
Expand Down

0 comments on commit 67cf2bf

Please sign in to comment.