Skip to content

Instantly share code, notes, and snippets.

@Fire-Dragon-DoL
Last active December 12, 2015 03:08
Show Gist options
  • Save Fire-Dragon-DoL/4704705 to your computer and use it in GitHub Desktop.
Save Fire-Dragon-DoL/4704705 to your computer and use it in GitHub Desktop.
class Ability
include CanCan::Ability
def initialize(user)
@user = user || User.new # for guest
guest
administrator if user.is_admin?
end
def guest
cannot [:is_admin=], User
end
def administrator
can [:is_admin=], User
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment