tab/app/models/ability.rb

14 lines
223 B
Ruby
Raw Normal View History

2015-09-08 17:18:38 +02:00
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user (not logged in)
if user.penning?
can :manage, :all
else
can :read, user, id: user.id
end
end
end