I am using Devise and interested in using Pundit but cannot find much on if it should be integrating with Rolify or if it is stand alone. CanCanCan works nicely with Rolify and
Why don't use them together? They can be easily used in a fashion like this
class OrganisationPolicy
def initialize(user, organisation)
@user = user
@organisation = organisation
end
def index?
@user.has_role? :admin
end
def show?
@user.has_role?(:admin) || @user.organisation == @organisation
end
end
In fact, the thing that rolify
and pundit
are not coupled is something nice, and not a design failure ;)