Created
October 9, 2013 20:44
-
-
Save fijimunkii/6908027 to your computer and use it in GitHub Desktop.
ruby: sinatra PG.connect helper
This file contains hidden or 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
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