I have assigned roles to users with resource Project
class User < ApplicationRecord rolify end class Project < ApplicationRecord resourcify end
Now what I need is to access the users with any role assigned with a specific project.
There is no direct way in the documentation. The closest being:
User.with_any_role(:user, :admin) but I cannot mention the resource in it.
And the other is:
Project.with_roles([:admin, :user], current_user) but with_roles is not working with the USER model.
Is there any way to fetch users of a specific project only?
Source: Stack Overflow