0

ohm provides a finder method for returning the first result, but doesn't seem to provide a similar .last finder method, is there something similar to the below for the returning the last result in a collection?

Book.find(authors: dave.id).first

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

user715697
  • 857
  • 1
  • 10
  • 20

1 Answers1

1

The short answer, is it doesn't, however, here is a solution:

Book.find(authors: dave.id).sort_by(:id, :order => "DESC").first
user715697
  • 857
  • 1
  • 10
  • 20