RolifyCommunity / rolify

Role management library with resource scoping
https://rolifycommunity.github.io/rolify/
MIT License
3.16k stars 404 forks source link

What is the Role lookup table model name? #483

Open archonic opened 6 years ago

archonic commented 6 years ago

I'm using Rolify in an app with Apartment. I have the models Account, User and AccountsUser. Rolify is on AccountsUser because users can have different roles in each account. I've added all of the above to the public schema and that's working for most methods. However, the roles method which lists all roles belonging to an AccountsUser is doing a join on accounts_users_roles. I haven't been able to add this table to the public schema.

Looking at ActiveRecord::Base.descendants, it seems to be AccountsUser::HABTM_Roles but that's not a model name I can pop into Apartment's config.excluded_models.

Any ideas how to solve this?

mikeheft commented 5 years ago

I use the resource name + role. So if I need to find/sort I do User.join(:user_roles)