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

Ensure uniqueness validation matcher works with STI #1610

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

matsales28
Copy link
Collaborator

Quotin @StefSchenkelaars on #1450:

The uniqueness validation matcher generates a fake class when the scope name ends on _type. This fake class is a duplicate of the original class. In most cases this is not a problem, however when using single table inheritance (STI), this new fake class is not a subclass of the original class and therefore ActiveRecord will throw an error. See #1245

These problems are fixed by making the fake class inherrit from the original class. Therefore it closes #1245 and closes #854

The uniqueness validation matcher generates a fake class when the
scope name ends on _type. This fake class is a duplicate of the
original class. In most cases this is not a problem, however when
using single table inheritance (STI), this new fake class is not
a subclass of the original class and therefore ActiveRecord will
throw an error. See #1245

These problems are fixed by making the fake class inherrit from the
original class. Therefore it closes #1245 and closes #854
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! Just one thing: any idea why the CI skipped the test/build process for version 3.3.0, using Rails 7.1 with SQLite3?

@matsales28
Copy link
Collaborator Author

LGTM! Just one thing: any idea why the CI skipped the test/build process for version 3.3.0, using Rails 7.1 with SQLite3?

Interesting, I didn't notice that. I'm re-running this test process. Not sure why it was skipped

@matsales28 matsales28 merged commit 5781741 into main Feb 9, 2024
16 checks passed
@matsales28 matsales28 deleted the ensure-uniqueness-works-with-sti branch February 9, 2024 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants