Reputation: 2415
How to get user who has an ID dividable by 3
something like :
User.where(id: id % 3 == 0)
thanks
Upvotes: 2
Views: 66
Reputation: 33548
You can use pure string condition here, because data is static (not coming from user for example):
User.where('id % 3 = 0')
Read more in official docs.
Upvotes: 2