Reputation: 171
I've got a cancan ability that works but I'm looking to get the opposite effect:
can :block, Company, id: user.company_id
here's what I've tried:
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
And none work at all. Can somebody help me define the correct ability?
Upvotes: 0
Views: 56
Reputation: 395
How about this?
can :block, Company do |company|
company.id != user.company_id
end
Upvotes: 1