阅读背景:

factory - girl如何添加具有不同角色的多个对象

来源:互联网 
class Ability

include CanCan::Ability

def initialize(user)

user ||= User.new # guest user

if user.has_role?  :student
  can :create, Atendimento
end

if user.has_role?  :professor
  can :create, Atendimento
end
if user.has_role? :administrative
  can [:read, :create], [Atendimento]
  can [:edit, :update], Atendimento
  can :manage, [Type, Place]
 end
if user.has_role? :admin
  can :manage, :all
end
end
end
class Ability

include CanCan::Ability

def ini



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: