trying to connect to heroku db

master
Matt Huntington 8 years ago
parent fe75d12839
commit 362c4189fe

@ -1,5 +1,10 @@
class Fruit class Fruit
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') DB = PG.connect(host: "localhost", port: 5432, dbname: 'simplerails')
end
def initialize(opts = {}) def initialize(opts = {})
@id = opts["id"].to_i @id = opts["id"].to_i

Loading…
Cancel
Save