Why cancancan methods return wrong value in view, but right in controller?

63 Views Asked by At

I have in cancancan abilities can(:manage, User, id: user.id)

When user opens own profile, then can? :update, @user in the UsersController#show returns correctly true, but in the show view it returns false.

Does anyone know what causes this inconsistency?

cancancan 3.1, rails 6.0.3.4

1

There are 1 best solutions below

0
On

Ok, I solved it. The problem was I called can? on decorator and it doesn't work. can? :update, @user.object works fine.