-2

Question for people who knows Rails with Cancan and Rolify gem. I want to understand how i can get list of user, that have some roles for (for example, Company).

Here is description with code and detailed description:

https://github.com/EppO/rolify/issues/260

Thanks for any ideas!

Vladimir

user1859243
  • 295
  • 1
  • 5
  • 11

1 Answers1

0

According to the documentation you have to use

@users = User.with_all_roles(:owner, :client, :manager, @company)

instead of

@users = User.with_role([:owner, :client, :manager], @company)

Or if you can get all the users who has at least one of the roles: has_any_role

See more: https://github.com/EppO/rolify/wiki/Usage#finders-methods

nistvan
  • 2,940
  • 1
  • 16
  • 20