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

Avoid querying nil belongs_to associations when recovering #219

Merged
merged 3 commits into from
Apr 24, 2021

Conversation

mvz
Copy link
Contributor

@mvz mvz commented Apr 24, 2021

For a belongs_to association where the foreign key is nil, the existing code would create a scope on the assoicated table with a where clause selecting id IS NULL. This would always fail to find any records, but it's better to not perform the query at all.

mvz added 3 commits April 24, 2021 11:56
For a belongs_to association where the foreign key is nil, the existing
code would create a scope on the assoicated table with a where clause
selecting id IS NULL. This would always fail to find any records, but
it's better to not perform the query at all.
@mvz mvz merged commit 6b9138c into master Apr 24, 2021
@mvz mvz deleted the avoid-extra-query branch April 24, 2021 11:27
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.

None yet

1 participant