mercredi 14 octobre 2015

CanCan Ability: can read Class if he can read at leas one Object of class

In cancan to be Able to :read all User for exemple we need

can :read,User

to be able to see a specific instance of the user we need

can :read, User do |user|
    user == something (condition satisfied ==> ability satisfied)
end

Now my question is : is it possible to check if the user can read at least one instance?? i have a menu where i have to show "users" in the menu if he can at least read one instance of a user otherwise not showing anything

Aucun commentaire:

Enregistrer un commentaire