Address soft deprecation of ActiveRecord::Base.connection
#869
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related: #705
Refs:
This will be soft deprecated in Rails 7.2.
The reason for this change is twofold.
We're running on Rails Edge with
active_record.permanent_connection_checkout = :deprecated
and this call to#connection
was logged as a violation. Our goal is to configure this with:disallowed
some day. Even if this needed to be a permanent checkout,connection
should ideally be swapped withlease_connection
(this would require a specific check to ensure the Rails dependency is >= 7.2).Despite being called inside a
with_connection
block, this call actually leases a connection and doesn't return it back to the pool until the end of the request, which seems to have been intention behind ActiveRecord adapter: wrap all reads/writes inwith_connection
#705. This ensures we use the connection temporarily leased bywith_connection
.