You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
User.with_role(:approver)
User Load (5.5ms) SELECT "users".* FROM "users" INNER JOIN "users_roles" ON "users_roles"."user_id" = "users"."id" INNER JOIN "roles" ON "roles"."id" = "users_roles"."role_id" WHERE (((roles.name = 'approver') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL))) /* loading for inspect */ LIMIT $1 [["LIMIT", 11]]
Role Model
class Role < ApplicationRecord
has_and_belongs_to_many :users, join_table: :users_roles
belongs_to :resource, polymorphic: true, touch: true
end
User Model
class User < ApplicationRecord
rolify before_add: :assign_child_roles
rolify after_add: :remove_requested_role
end
When i'm trying to query all users with approval roles. It does not find all users(irrespective of resource). It find all users who has approval role and whose resource type is nil.
The text was updated successfully, but these errors were encountered:
Role Model
User Model
When i'm trying to query all users with approval roles. It does not find all users(irrespective of resource). It find all users who has approval role and whose resource type is nil.
The text was updated successfully, but these errors were encountered: