0
votes

I am using activeadmin with cancancan gem. Where I need to update only 2 fields from user model.

For ex. If we can say, I have User model with name, email, is_admin, is_active.

But from admin, I need to create ability like that where I can only update is_admin and is_active attributes of a User model.

Right now I am trying with this but it's not working:

can [:read, :update], User, :attributes => [:is_admin, :is_active]

1
do you have separate model for admin and user?uzaif
yes. AdminUser and User is separate modelSachin Gevariya
in user model you have field called role fileduzaif
try this can [:read,:update], User, is_active: true,is_admin:trueuzaif

1 Answers

0
votes

In this cancan not help, cancan used to authorize resource. You need to create custom active admin form to achieve this. For this you can take reference here.