Created
March 15, 2012 04:41
-
-
Save hopsoft/2041938 to your computer and use it in GitHub Desktop.
Ability - cancan abstract resource authorization
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
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