Skip to content

Instantly share code, notes, and snippets.

@adamwiggins
Created February 23, 2010 21:58
Show Gist options
  • Save adamwiggins/312764 to your computer and use it in GitHub Desktop.
Save adamwiggins/312764 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment