Last active
August 29, 2015 14:06
-
-
Save campanalbero/d820772d0ccc15671da9 to your computer and use it in GitHub Desktop.
sequel で first / last
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sequel' | |
require 'pp' | |
DB = Sequel.sqlite('photo.db') | |
dataset = DB[:photos] | |
pp dataset.first | |
# dataset.first は order by がなくてもうまくいが dataset.last は order を指定してないと怒られる理不尽仕様 | |
pp dataset.order_by(:date_time_original).last |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment