Method: Sequel::Model::DatasetMethods#last
- Defined in:
- lib/sequel/model/base.rb
permalink #last(*a, &block) ⇒ Object
If there is no order already defined on this dataset, order it by the primary key and call last.
Album.last
# SELECT * FROM albums ORDER BY id DESC LIMIT 1
2188 2189 2190 2191 2192 2193 2194 |
# File 'lib/sequel/model/base.rb', line 2188 def last(*a, &block) if ds = _primary_key_order ds.last(*a, &block) else super end end |