-
-
Save lazybios/9fd2efca4b6433678c96 to your computer and use it in GitHub Desktop.
CanCan helper for a Grape API implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def authorize!(role={}, object) | |
ability = Ability.new(current_user) | |
unless ability.can?(role, object) | |
unauthorized! | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment