Fix uncached to operate on the connection's own pool rather than ActiveRecord::Base's pool#25
Merged
jcoleman merged 2 commits intojcoleman:masterfrom Apr 28, 2026
Merged
Conversation
…veRecord::Base's pool ActiveRecord::Base.uncached only disables the query cache on ActiveRecord::Base's connection pool. When called on a connection belonging to a different pool (e.g. a sharded connection), the cache was not bypassed. Switching to uncached without the ActiveRecord::Base receiver fixes this, since AbstractAdapter#uncached delegates to the connection's own pool. Bump sqlite3 development dependency to >= 2.1 to align with Rails 8 requirements.
jcoleman
requested changes
Apr 28, 2026
Owner
jcoleman
left a comment
There was a problem hiding this comment.
We should also add tests to https://github.com/jcoleman/relation_to_struct/blob/master/spec/active_record_base_spec.rb
Otherwise, this LGTM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Test plan
context "with a secondary connection pool"block that creates a separate connection pool and verifies each method bypasses the cache on that pool — the scenario that was broken before this fix.