Sha256: 69a1dc270c015edc59edfd63e2030e12936c54730bd45e172586172a8aa3eca6
Contents?: true
Size: 412 Bytes
Versions: 4
Compression:
Stored size: 412 Bytes
Contents
class Ability include CanCan::Ability attr_reader :user def initialize(user) @user = user || User.new @user.roles.each { |role| send(role.name.downcase) } if @user.roles.size == 0 guest end end def guest end def account_holder can :manage, Todo, user_id: user.id can :create, User can [:read, :update], user end def admin can :manage, :all end end
Version data entries
4 entries across 4 versions & 1 rubygems