How to fetch the previous or next record

David Hughes wrote:

#For Prev Record
@foo = Foo.find(:first, :conditions => ["id < ?", params[:id]])

Ooops - the above should include :order => 'id DESC' at the end or else
it returns the first record in the table.

And the next case should include :order => "id'

There's really no guarantee that an unordered find will sort by primary key.