내 ability.rb 파일에서 정의 된 사용자 만 작업을 수행 할 수 있도록 설정하려면 어떻게해야합니까? 그렇지 않으면 정의되지 않은/로그인하지 않은 사용자가 아무 것도 할 수 없습니까?CanCan에서 사용자 작업을 허용하지 않으려면 어떻게해야합니까?
예 :
def initialize(user)
user ||= User.new #not logged in user
if user.admin_user?
can :manage, :all
else
#can't do anything. Cannot view, edit, or update.
end
end
감사합니다!