Quickly test an ability

suggest change

To check an ability in the console, or anywhere else the Rails environment is loaded, pass a user:

test_ability = Ability.new(User.first)
test_ability.can?(:show, Post) #=> true
other_ability = Ability.new(RestrictedUser.first)
other_ability.cannot?(:show, Post) #=> true

More information: https://github.com/CanCanCommunity/cancancan/wiki/Testing-Abilities

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents