rails
rails copied to clipboard
[Fix #51164] `Model.query_constraints` with single non-primary-key column raises incorrect error
Motivation / Background
Fixes #51164.
Detail
This Pull Request changes ActiveRecord::Reflection::AssociationReflection#derive_fk_query_constraints
to raise an existing more appropriate error if Model.query_constraints
is given a single non-primary-key column argument.
Additional information
Checklist
Before submitting the PR make sure the following are checked:
- [x] This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
- [x] Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex:
[Fix #issue-number]
- [x] Tests are added or updated if you fix a bug or add a feature.
- [x] CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.