tab/app/models/ability.rb
2015-09-09 16:51:41 +02:00

14 lines
268 B
Ruby

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
can :create, Transaction, debtor: user
end
end
end