Is Cancan's accessible_by my best choice for altering admin scope on the fly?
Posted
by
evanchurchill
on Stack Overflow
See other posts from Stack Overflow
or by evanchurchill
Published on 2013-10-17T00:11:10Z
Indexed on
2013/10/17
21:54 UTC
Read the original article
Hit count: 288
ruby-on-rails
|cancan
Situation: On my site, I have a comment model, with a deleted field. Users cannot see deleted comments, but I would like to allow admins to see deleted comments, if they choose to. This will be accomplished by having a scope for users with the admin role which allows them to view comments with the deleted field set to false, as well as true.
Question: Is Cancan's accessible_by method my best choice for doing so? From what I've read, it sounds like it will facilitate exactly what I'm trying to do, but, I don't want to implement something that is inefficient, if there is a better method.
© Stack Overflow or respective owner