Check rule's subject's inheritance if subject is a Class or Module#877
Open
kevinluo201 wants to merge 1 commit intoCanCanCommunity:developfrom
Open
Check rule's subject's inheritance if subject is a Class or Module#877kevinluo201 wants to merge 1 commit intoCanCanCommunity:developfrom
kevinluo201 wants to merge 1 commit intoCanCanCommunity:developfrom
Conversation
…tches or is an ancestor
Author
|
Hi @coorasse, this is my first time contributing to this project. Would you mind helping me review this PR? Does it need to pass any CI? Thank you 🙏 |
Author
|
@brynary @macav @Senjai @amitsuryavanshi Sorry to bother you 🥹 I just want to ask if anyone can review this PR if they're available. 🙏 |
|
@coorasse any ETA when this PR will be merged? I'm running into this issue on a project, trying to decided whether to monkey patch or wait for this to be merged. /cc @kevinluo201 |
|
@kevinluo201 any updates on this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change fixes the following problem of STI classes
The reason is that
relevant_ruleswill fetch both ancestors and subclasses rules when ActiveRecord is used, where non-sti classes don't have this problem.The fix is simple: just check if the rule's subject is a ancestor or itself