Reputation: 92
ruby 2.7.8 rails 6.1.7.7 cancancan 3.5.0
I have upgraded cancancan in favor of upgrading rails version to 6.1.7.7, but now ability file is behaving really weird specially the ones with STI. I have to rearrange the permission sequence to pass my test cases.
Is anyone know what have changed or it is only related to my application. There is an open issue as well in cancancan for STI https://github.com/CanCanCommunity/cancancan/issues/809
for example
can :manage, [User::Base,
User::Customer,
User::Employee]
can :read, UserFollowedRecord, post_id: Post.accessible_by(self).ids
with the above while looking for Post.accessible_by(self).ids adding type in query with 'customer' and 'employee' and breaks with type column not defined on post
but the below snippet works correctly
can :manage, [User::Base]
can :read, UserFollowedRecord, post_id: Post.accessible_by(self).ids
can :manage, [User::Customer,
User::Employee]
Upvotes: 0
Views: 64