Padrino, MongoHQ and Heroku
Next time I google for this I’ll find the answer waiting:
1 2 3 4 5 6 7 8 9 |
# config/database.rb if ENV['MONGOHQ_URL'] uri = URI.parse(ENV['MONGOHQ_URL']) MongoMapper.connection = Mongo::Connection.from_uri(ENV['MONGOHQ_URL'], :logger => logger) MongoMapper.database = uri.path.gsub(/^\//, '') else MongoMapper.connection = Mongo::Connection.new('localhost', nil, :logger => logger) MongoMapper.database = "myapp_#{Padrino.env}" end |
Also I’ll write MongoDB here for google. Nicked from Fikus.