My users have and belong to many roles, and likewise my roles have and belong to many users.
How can I select all users who have the role "editor"? How can I select all users who have only the role "editor"?
My users have and belong to many roles, and likewise my roles have and belong to many users.
How can I select all users who have the role "editor"? How can I select all users who have only the role "editor"?
How can I select all users who have the role "editor"?
Role.find_by_name('editor').users
How can I select all users who have only the role "editor"?
For that, you'll probably have to pass pure sql condition in the 'find' method.