Skip to content

Instantly share code, notes, and snippets.

@vanderhoop
Created May 5, 2014 20:30
Show Gist options
  • Select an option

  • Save vanderhoop/e578b537d7ad9f1f05aa to your computer and use it in GitHub Desktop.

Select an option

Save vanderhoop/e578b537d7ad9f1f05aa to your computer and use it in GitHub Desktop.
require 'pg'
db_conn = PG.connect(dbname: 'shopping_db')
result = db_conn.exec(string_of_sql)
entry_as_hash = result[0] # yield a hash of the first row.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment