Skip to content

Conversation

@kevinluo201
Copy link

This change fixes the following problem of STI classes

# given "class Child < Parent"
can :read, Parent
cannot :read, Child

can? :read, Parent # => false, but should be true

The reason is that relevant_rules will 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

@kevinluo201
Copy link
Author

kevinluo201 commented Mar 2, 2025

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 🙏

@kevinluo201
Copy link
Author

@brynary @macav @Senjai @amitsuryavanshi Sorry to bother you 🥹 I just want to ask if anyone can review this PR if they're available. 🙏

@dalezak
Copy link

dalezak commented Jun 20, 2025

@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

@23tux
Copy link

23tux commented Oct 20, 2025

@kevinluo201 any updates on this?

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.

3 participants