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

Explicit primary_key: option should always take priority in associations #49264

Conversation

nvasilevski
Copy link
Contributor

This PR fixes the issue where the primary_key: option was ignored if the associated model had a query_constraints configured. Now primary_key: option always takes priority and only if there is no primary_key: option, the query_constraints are used to determine the association_primary_key value.

Technically now this is a bug in Rails 7.1 beta so I presume we want a changelog entry and the commit to be backported to 7-1-stable if such exist? Let me know whether it needs a CHANGELOG entry and how to ensure it gets included into the next release as a bugfix

…tions

This commit fixes the issue where the `primary_key:` option was ignored
if the associated model had a `query_constraints` configured.
Now `primary_key:` option always takes priority and only if there is no
`primary_key:` option, the `query_constraints` are used to determine
the `association_primary_key` value.
@eileencodes eileencodes merged commit 910eb47 into rails:main Sep 14, 2023
4 checks passed
@eileencodes eileencodes deleted the explicitly-configured-primary-key-option-must-take-priority-in-association-primary-key branch September 14, 2023 15:48
@eileencodes
Copy link
Member

Technically now this is a bug in Rails 7.1 beta so I presume we want a changelog entry and the commit to be backported to 7-1-stable if such exist?

There isn't a 7-1-stable yet, so we don't need a backport.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants