Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- config_file = Rails.root.join('config/mongo.yml')
- if config_file.file?
- config = YAML.load(ERB.new(config_file.read).result)[Rails.env]
- MongoMapper.connection = Mongo::Connection.new(config['host'], config['port'], :logger => Rails.logger)
- if config['username']
- conn.authenticate(config['username'], config['password']) || raise("Invalid MongoDB Authentication")
- end
- MongoMapper.database = config['database']
- end
Add Comment
Please, Sign In to add comment