Created
November 14, 2014 17:12
-
-
Save thomasbiddle/d891e7d79b28f28f9688 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