I am modifying some of my CanCan user actions in the Ability class to use blocks instead of a hash, but now they have stopped actually restricting access. It is strange that the built-in actions, such as: manage and: create, etc., seem to still work fine with blocks.
This is one example:
OLD
can :share, Project, :user_id => user.id
NEW
can :share, Project do |project|
project.users.exists?(user)
end
Has anyone encountered this problem before?
source
share