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

feat: Add query_constraints modifier to AssociationMatcher #1604

Conversation

matsales28
Copy link
Member

Closes: #1592

Rails 7.1 introduced the query_constraints qualifier that can be passed to the association definition.

For example:

class Author < ApplicationRecord
  self.primary_key = [:first_name, :last_name]
  has_many :books, query_constraints: [:author_first_name, :author_last_name]
end

class Book < ApplicationRecord
  belongs_to :author, query_constraints: [:author_first_name, :author_last_name]
end

We're adding this qualifier to the association matchers.

@matsales28 matsales28 self-assigned this Jan 12, 2024
@matsales28 matsales28 requested a review from vsppedro as a code owner January 12, 2024 19:09
@matsales28 matsales28 force-pushed the 1592-add-query_constraints-qualifier-to-the-association-matcher branch from 3ad7be7 to 8e715e5 Compare January 12, 2024 19:12
@matsales28 matsales28 force-pushed the 1592-add-query_constraints-qualifier-to-the-association-matcher branch from 8e715e5 to 48c612c Compare January 12, 2024 19:35
Copy link
Collaborator

@vsppedro vsppedro left a comment

Choose a reason for hiding this comment

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

LGTM! I believe it's time to consider a new release due to the bug fix in the master branch - #1603. I'm available to begin working on it over the next few weeks, but if you would like to work on it, please let me know.

@matsales28
Copy link
Member Author

LGTM! I believe it's time to consider a new release due to the bug fix in the master branch - #1603. I'm available to begin working on it over the next few weeks, but if you would like to work on it, please let me know.

@vsppedro I have time to work on it this Friday if you haven't started yet.

@vsppedro
Copy link
Collaborator

Please, do. I need to give some love to snowglobe, shoulda-context and shoulda.

@matsales28 matsales28 merged commit dde9883 into main Jan 19, 2024
16 checks passed
@matsales28 matsales28 deleted the 1592-add-query_constraints-qualifier-to-the-association-matcher branch January 19, 2024 14:07
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.

Add query_constraints qualifier to the association matcher.
2 participants