Rails activerecord where in get results in specific order

前端 未结 0 1461
你的背包
你的背包 2020-12-07 23:06
ids = [15, 7, 50]
results = Model.where(id: ids)

the results would be model with id 7, 15, 50 in this order, how can i get results by the order of i

相关标签:
回答
  • 消灭零回复
提交回复
热议问题