{ 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]
,活动记录是否提供任何便利功能?
答案 0 :(得分:3)
您正在寻找offset
。
另请注意,未将order
传递给查询并不能保证查询将返回主键排序的实例。所以最好传递一个明确的order
。
Opportunity.order(:id).limit(1).offset(2)