Skip to content

Instantly share code, notes, and snippets.

@hopsoft
Created March 15, 2012 04:41
Show Gist options
  • Save hopsoft/2041938 to your computer and use it in GitHub Desktop.
Save hopsoft/2041938 to your computer and use it in GitHub Desktop.
Ability - cancan abstract resource authorization
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
resourceful_actions = [
:index,
:show,
:new,
:create,
:edit,
:update,
:destroy
]
cannot resourceful_actions, User
can :update, User, :id => user.id
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment