Closed oldschoolguy closed 10 years ago
I think the confusion here is that Ability will default to false. Unless you've explicitly granted the ability, it is not there.
cannot :otherthing, Post do |p| false end
Does not mean that the user can otherthing, it just falls back to the default. If you really want the functionality implied above, you should do:
can :otherthing, Post do |p| true end
OK, I get it. Makes perfect sense. Sorry for the confusion.
If you are specifying
cannot
rules with block arguments in theAbility
class, the block argument has no effect.How to reproduce:
app/models/ability.rb:
Rails console:
The return value is false for all possible combinations - hence specifying the block has no effect.
Can somebody provide me with a solution for this?