The guidance in this post shows how to use rolify with pundit authorisations.
I'm trying to figure out how to this in my Rails app.
What's confusing me about the answer in the linked post is that the index action checks for :admin
, where the show action checks for (:admin)
. Is there a reason for the brackets in some cases?
Why is Pundit not coupled with Rolify like CanCanCan is?
def index?
@user.has_role? :admin
end
def show?
@user.has_role?(:admin) || @user.organisation == @organisation
end