Skip to content

Instantly share code, notes, and snippets.

@mt9304
Created October 8, 2018 19:30
Embed
What would you like to do?
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
if user.normal_user?
can :read, Book
can :create, Book
elsif user.admin?
can :manage, :all
else
can :read, Book
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment