{ topic: "Foo", opportunity: Opportunity.limit(15)[0] },
{ topic: "Foo", opportunity: Opportunity.limit(15)[2] },
{ topic: "Foo", opportunity: Opportunity.limit(15)[7] },
{ topic: "Foo", opportunity: Opportunity.limit(15)[9] },
{ topic: "Foo", opportunity: Opportunity.limit(15)[11]}
活动记录是否提供任何便利功能,而不是执行
Opportunity.limit(15)[n]
? 最佳答案
您正在查找offset
。
还要注意,不向查询传递order
并不保证查询将返回按主键排序的实例。所以最好传递一个显式的order
。Opportunity.order(:id).limit(1).offset(2)