Skip to content

Instantly share code, notes, and snippets.

@thomasbiddle
Created November 14, 2014 17:12
Show Gist options
  • Save thomasbiddle/d891e7d79b28f28f9688 to your computer and use it in GitHub Desktop.
Save thomasbiddle/d891e7d79b28f28f9688 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