从 ActiveRecord 中的一系列 id 中搜索 [英] Searching from a range of ids in ActiveRecord
本文介绍了从 ActiveRecord 中的一系列 id 中搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎样才能在范围内做这样的事情?
How can I do something like this in range?
User.find(14000..14500)
我需要选择特定范围内的用户开始和结束特定 ID.
I need to choose a certain range of Users starting and finishing on specifics ids.
推荐答案
使用 where
方法:
Use the where
method:
User.where(id: 14000..14500)
这篇关于从 ActiveRecord 中的一系列 id 中搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文