How can i use scoping with active admin & cancan.
I have admin users & those have (has_one) relation with institution
and institution has many profiles
Now when admin user login then i want display all profiles which has same institution.
Doesn’t find following link much helpful.
http://activeadmin.info/docs/2-resource-customization.html#scoping_the_queries
if you just do simply this, do you get a problem?
this will allow:
Profile.accessible_by(current_user), which here is same ascurrent_user.profilesif you want superadmin to access all posts, you can use the :association_method option
A tricky solution could generalize this and use a delegator class as proxy to unscope all models for superadmins. i can spell out on request.