Skip to content

Instantly share code, notes, and snippets.

@lazybios
Forked from thomasbiddle/cancan-grape.rb
Last active August 26, 2015 15:04
Show Gist options
  • Save lazybios/9fd2efca4b6433678c96 to your computer and use it in GitHub Desktop.
Save lazybios/9fd2efca4b6433678c96 to your computer and use it in GitHub Desktop.
CanCan helper for a Grape API implementation
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