Skip to content

Instantly share code, notes, and snippets.

@dylanerichards
Created October 11, 2016 00:06
Show Gist options
  • Save dylanerichards/009f954ccb3ab20ea0ce2030e003bef0 to your computer and use it in GitHub Desktop.
Save dylanerichards/009f954ccb3ab20ea0ce2030e003bef0 to your computer and use it in GitHub Desktop.
def find(id)
cmd = `sqlite3 test "select * from things where id = #{id}"`
end
def all
users_array = []
users = `sqlite3 test "select * from things;"`.split("\n")
users.each { |user| users_array << user }
users_array
end
def first
all.first
end
def last
all.last
end
p last
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment