Skip to content

Fix CanCan::RulesCompressor for STI subclasses#880

Open
takayamaki wants to merge 5 commits intoCanCanCommunity:developfrom
takayamaki:fix/rules_compressor
Open

Fix CanCan::RulesCompressor for STI subclasses#880
takayamaki wants to merge 5 commits intoCanCanCommunity:developfrom
takayamaki:fix/rules_compressor

Conversation

@takayamaki
Copy link
Copy Markdown

This pull request fixes in the RulesCompressor class related to STI subclasses.

This PR may fix #874.

expexted and actual behavior

class Vehicle < ApplicationRecord; end
class Car < Vehicle; end
class Motorbike < Vehicle; end

Car.create!
Motorbike.create!

ability = Ability.new()
car = ability.can :read, Car
motorbike = ability.can :read, Motorbike

Vehicle.accessible_by(ability)
# expected => [car, motorbike]
# actual => [motorbike]
# missing => [car]

@23tux
Copy link
Copy Markdown

23tux commented Nov 11, 2025

Whats the state of this PR? We still have the issue from #874

@23tux
Copy link
Copy Markdown

23tux commented Mar 2, 2026

Alas, no response so far. It would be great if anyone from the maintainer could accept this PR, this would really help us. It seems that the whole repository is dead, last commit to the develop branch was January 2025 :(

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.

STI ability overwrites previously defined STI rules

2 participants