ryanb/cancan — Issue #494: 'can?' returns wrong result when ability defined with block
Author: emiltin
Created: 2011-10-20 17:58:29+00:00
State: open

If I define an ability using a block:

def initialize(user)
can :edit, Project do |project|
false
end
end

I get unexpected results if I pass a class when checking abilities:

can? :edit, my_project => false, as expected
can? :edit, Project => true. this must be a bug?

I realize that the block is not called when I pass a class, but why is true ever returned? It seems the block somehow makes cancan believe the ability is granted.