Issue when retrieving records with empty array

前端 未结 5 892
感动是毒
感动是毒 2020-12-03 10:00

I have a table of around 100 Users and I also have an array of user ids. What I wanted to do is show all users who are not a part of this array of user ids. When I do someth

5条回答
  •  余生分开走
    2020-12-03 10:37

    Use ruby's active record wrapper:

    User.where.not(id: [])
    

    This handles the empty array issue for you.

提交回复
热议问题