Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@vangberg
Created August 29, 2012 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vangberg/3516828 to your computer and use it in GitHub Desktop.
Save vangberg/3516828 to your computer and use it in GitHub Desktop.
require "sequel"
db = Sequel.sqlite
db.create_table :items do
primary_key :id
String :file
end
set = db[:items]
set.insert(:file => "a")
set.insert(:file => "a")
set.insert(:file => "b")
set.group(:file).all
#=> [{:id=>2, :file=>"a"}, {:id=>3, :file=>"b"}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment