-
Notifications
You must be signed in to change notification settings - Fork 125
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
Make scopes available for abstract classes #1250
Make scopes available for abstract classes #1250
Conversation
af838b3
to
2f072ae
Compare
Can't see this part in the PR. Is that missing or did you decide against this? |
2f072ae
to
3572410
Compare
@paracycle Sorry, looks like I forgot to push this commit 🙈 It's there now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! We will have to check this against Core to make sure that we don't get any unwanted behaviour before merging though.
Ah, I just ran into this too. @paracycle, did this end up having unexpected behavior, or is it maybe good to merge? 😄 |
5b87ff3
to
e64d47c
Compare
Co-authored-by: Ufuk Kayserilioglu <ufuk.kayserilioglu@shopify.com>
e64d47c
to
531eaca
Compare
Ok, I just had a chance to test this against Shopify Core and it seems to work. However, I removed the commit that was making AR relations to consider abstract classes as well, since that's not related to scopes and I don't think we would want folks to write relations off of abstract classes. |
Motivation
At the moment sorbet can't figure out that classes, that are marked as abstract, have access to scopes. The following example illustrates this:
Since those scopes can be used, I think it makes sense to generate the rbi files accordingly.
Implementation
I removed the filter for abstract classes in
ActiveRecordScope
and did the same thing inActiveRecordRelations
to make the generated relation methods work.Tests
Tests for
ActiveRecordScope
have been extended.