tap/app/models/ability.rb

13 lines
207 B
Ruby
Raw Normal View History

2014-12-09 19:44:58 +01:00
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user (not logged in)
if user.admin?
can :manage, :all
else
can :read, :all
end
end
end