You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classAbilityAincludeCanCan::Abilitydefinitializecan:destroy,Eventdo |event|
putsself.class.name# this will output "AbilityA" even when the rule is called by AbilityB after the merge.can?:access_edit_mode,eventendendendclassAbilityBincludeCanCan::Abilitydefinitializemerge(AbilityA.new)can:access_edit_mode,Eventdo |event|
puts"access edit mode from #{self.class.name}"trueendendendAbilityB.new.can?:destroy,Event.last# AbilityA# => false
Expected behavior
My understanding of merge would be that it would copy the can :destroy, Event from AbilityA in AbilityB, making AbilityB equivalent to:
The can :destroy, event rule is still bound to AbilityA, which means that when it's calling can? :access_edit_mode, event, it is not found, because AbilityA does not have this rule, and the one from AbilityB is never called.
System configuration
Rails version:
6.1.7.3
Ruby version:
3.0.6
CanCanCan version
3.3.0
The text was updated successfully, but these errors were encountered:
Steps to reproduce
Expected behavior
My understanding of
merge
would be that it would copy thecan :destroy, Event
from AbilityA in AbilityB, making AbilityB equivalent to:Actual behavior
The
can :destroy, event
rule is still bound to AbilityA, which means that when it's callingcan? :access_edit_mode, event
, it is not found, because AbilityA does not have this rule, and the one from AbilityB is never called.System configuration
Rails version:
6.1.7.3
Ruby version:
3.0.6
CanCanCan version
3.3.0
The text was updated successfully, but these errors were encountered: