Reputation: 34093
class User < ActiveRecord::Base
enum role: %w(employee admin manager)
end
How can I find all users with the role "admin"?
This doesn't return any user: User.where(role: "admin")
Upvotes: 0
Views: 123
Reputation: 5157
You can do it like
User.where(role: User.roles['admin'])
Also
User.admin
works for your case
Upvotes: 1