-1

Given this class

class User < Sequel::Model
  one_to_many :rounds, order: :date
end   

What I'm trying to do is sort by descending date.

I tried this like ActiveRecord supports, but that is not the way to go.

one_to_many :rounds, order: date: :desc

One solution is to create a dataset method but I feel there must be a better way to do this.

Eyeslandic
  • 14,553
  • 13
  • 41
  • 54

1 Answers1

0

The way to do this is to use one of the many "builders" that come with Sequel.

This time namely the Sequel.desc one.

one_to_many :rounds, order: Sequel.desc(:date)
Eyeslandic
  • 14,553
  • 13
  • 41
  • 54