defining ability permission in a block #780

erwin16 opened this Issue Nov 11, 2012 · 2 comments


None yet
3 participants

erwin16 commented Nov 11, 2012

I am using Cancan and Rolify together..
if can write :

if admin.has_role? :manager
  can [:read, :new, :edit], Admin
  can :update, Admin, :id => admin[:id]
  cannot [:destroy, :lock, :unlock], Admin, :id => admin[:id]
  can [:update, :destroy, :lock, :unlock, :reset_passord], Admin.employees

( I defined an employees scope in Admin)

My issue comes with creating new Admin instance being only roles as employee
I don't know how I can set permissions for create
can :create, Admin.employees

this doesn't work ... obviously can :create, Admin works but in this case Admin :manager can role..

On create , I have a transient attribute 'manager' ( true/false ) in the form, and I also tried
ability.can? :create, => false)
but this doesn't work either

any clue ?

Have you managed to come up with a solution to this, or is it still a problem for you?

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