我有一种可行的康康技能,但我希望得到相反的效果:
can :block, Company, id: user.company_id
这是我尝试过的:
can :block, Company, id: !user.company_id
cannot :block, Company, id: user.company_id
cannot :block, Company, :id => user.company_id
can :block, Company, :id => !user.company_id
根本没有工作。有人可以帮我定义正确的能力吗?
答案 0 :(得分:1)
这个怎么样?
can :block, Company do |company|
company.id != user.company_id
end