user3358045
user3358045

Reputation: 7

Rails 4 - find in array field in database

I have stored all user's roles in database field like this - roles: ["customer", "employee"]. This field has structure like array. I need select all employees.

Please, could you advise me, how to do that?

Upvotes: 0

Views: 52

Answers (1)

Thaha kp
Thaha kp

Reputation: 3709

User.where(roles: "%employee%")

Upvotes: 2

Related Questions