Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix valid_raw_connection check #517

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

rporrasluc
Copy link
Contributor

When upgrading to Rails 7.1, I observed that the client_connection was nil sometimes. It was found out that this is caused by @raw_connection being used instead of valid_raw_connection. We are using respond_to? without a second parameter but the method valid_raw_connection is private.

pry(#<ActiveRecord::ConnectionAdapters::VitessMysql2Adapter>)> self.class
=> ActiveRecord::ConnectionAdapters::VitessMysql2Adapter
pry(#<ActiveRecord::ConnectionAdapters::VitessMysql2Adapter>)> ::Rails.version
=> "7.1.2"
pry(#<ActiveRecord::ConnectionAdapters::VitessMysql2Adapter>)> respond_to?(:valid_raw_connection)
=> false
pry(#<ActiveRecord::ConnectionAdapters::VitessMysql2Adapter>)> respond_to?(:valid_raw_connection, true)
=> true

Copy link
Contributor

@adrianna-chang-shopify adrianna-chang-shopify left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@rporrasluc rporrasluc merged commit e9b973a into main Jan 10, 2024
42 checks passed
@rporrasluc rporrasluc deleted the rporrasluc/valid-raw-connection-private branch January 10, 2024 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants