mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-11-22 11:02:30 +01:00
12 lines
303 B
Ruby
12 lines
303 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
class Currency < Sequel::Model
|
||
|
dataset_module do
|
||
|
def latest(date = Date.today)
|
||
|
where(date: select(:date).where(Sequel.lit('date <= ?', date))
|
||
|
.order(Sequel.desc(:date))
|
||
|
.limit(1))
|
||
|
end
|
||
|
end
|
||
|
end
|