1
我想添加管理员角色。管理员应该能够销毁并更新所有内容。
管理员是user.id = 1
如何在CanCan中设置管理员角色?
我该如何在此编码?
型号/ ability.rb
if user
.....
can :read, :all
can [:create, :destroy], Comment, {:user_id => user.id}
can [:destroy], Comment, {:commentable_id => user.id, :commentable_type => user.class.name}
can [:create, :update], Community, {:user_id => user.id}
.....
else
can :read, :all
end