I struggled with the way we setup the connection to postgres in development and having that work on heroku. I spent a decently long time googling around to find a implementation file that would switch connection techniques depending on the environment. Here's the like that guided me to the solution http://mherman.org/blog/2013/06/08/designing-with-class-sinatra-plus-postgresql-plus-heroku/#.Uu-7AfldU1I