trying to connect to heroku db

master
Matt Huntington 8 years ago
parent fe75d12839
commit 362c4189fe

@ -1,6 +1,11 @@
class Fruit
DB = PG.connect(host: "localhost", port: 5432, dbname: 'simplerails')
if(ENV['DATABASE_URL'])
uri = URI.parse(ENV['DATABASE_URL'])
DB = PG.connect(uri.hostname, uri.port, nil, nil, uri.path[1..-1], uri.user, uri.password)
else
DB = PG.connect(host: "localhost", port: 5432, dbname: 'simplerails')
end
def initialize(opts = {})
@id = opts["id"].to_i
@name = opts["name"]

Loading…
Cancel
Save