gpt4 book ai didi

redis - 返回集合中最后一项的Finder方法,redis,ohm

转载 作者:可可西里 更新时间:2023-11-01 11:22:14 25 4
gpt4 key购买 nike

ohm提供了返回第一个结果的finder方法,但是好像没有提供类似的.last finder方法,有没有类似于下面的返回集合中最后一个结果的方法?

Book.find(作者:dave.id).first

http://ohm.keyvalue.org/Ohm/Collection.html#first-instance_method

最佳答案

简短的回答是不是,但是,这是一个解决方案:

Book.find(authors: dave.id).sort_by(:id, :order => "DESC").first

关于redis - 返回集合中最后一项的Finder方法,redis,ohm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20744598/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com