Resource role queries

Starting with rolify 3.0, you can search roles on instance level or class level resources.

Instance level

forum =Forum.first
forum.roles
# => [ list of roles that are only bound to a forum instance ]
forum.applied_roles
# => [ list of roles bound to a forum instance and to the Forum class ]

Class level

Forum.with_role(:admin)
# => [ list of Forum instances that has the role "admin" bound to it ] Forum.with_role(:admin, current_user)
# => [ list of Forum instances that has the role "admin" bound to it and belongs to current_user roles ]Forum.find_roles
# => [ list of roles that are bound to any Forum instance or to the Forum class ]Forum.find_roles(:admin)
# => [ list of roles that are bound to any Forum instance or to the Forum class with "admin" as a role name ]Forum.find_roles(:admin, current_user)
# => [ list of roles that are bound to any Forum instance or to the Forum class with "admin" as a role name and belongs to current_user roles ]