Check ability on Class #783

Open
panSarin opened this Issue Nov 19, 2012 · 3 comments

Projects

None yet

3 participants

@panSarin

In wiki we can read:
Important: If a block or hash of conditions exist they will be ignored when checking on a class, and it will return true. For example:

can :read, Project, :priority => 3
can? :read, Project # returns true
It is impossible to answer this can? question completely because not enough detail is given. Here the class does not have a priority attribute to check on.

My question is if i can do something like
can? :read, Project, :all so i can check if current ability have any conditions on Project reading or it always can read all of them ?

@panSarin

And there is a way i tried to do this :
https://gist.github.com/4111261
and the thing is : for each selected element, can? return false, but for
can? :update, Policy, Policy.joins(:policies_users).where("policies_users.user_id != #{current_user.id} and contract_id = #{Contract.find_by_name('Agent').id}")
it returns true. I do something wrong with my ability model, or i just use cancan wrong way ?

@qnm
qnm commented Feb 28, 2013

Hi @panSarin is this still an issue for you?

@xhoy
xhoy commented Jul 1, 2014

Thanks for your submission! The ryanb/cancan repository has been inactive since Sep 06, 2013.
Since only Ryan himself has commit permissions, the CanCan project is on a standstill.

CanCan has many open issues, including missing support for Rails 4. To keep CanCan alive, an active fork exists at cancancommunity/cancancan. The new gem is cancancan. More info is available at #994.

If your pull request or issue is still applicable, it would be really appreciated if you resubmit it to CanCanCan.

We hope to see you on the other side!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment