Skip to content

Instantly share code, notes, and snippets.

View benwyrosdick's full-sized avatar

Ben Wyrosdick benwyrosdick

View GitHub Profile
config = URI.parse(ENV['MONGO_URL'] || 'mongodb://localhost:27017/thedb')
MongoMapper.connection = Mongo::Connection.new(config.host, config.port)
MongoMapper.database = config.path.gsub(/^\//, '')
MongoMapper.database.authenticate(config.user, config.password) if config.user