Skip to content

Instantly share code, notes, and snippets.

@fijimunkii
Created October 9, 2013 20:44
Show Gist options
  • Save fijimunkii/6908027 to your computer and use it in GitHub Desktop.
Save fijimunkii/6908027 to your computer and use it in GitHub Desktop.
ruby: sinatra PG.connect helper
helpers do
def db_exec(sql)
conn = PG.connect(:dbname =>'DB_NAME', :host => 'localhost')
result = conn.exec(sql)
conn.close
result
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment