jnunemaker/mongomapper — pull request #413 by justcfx2u (2012-05-01 01:38:53+00:00)
Title: Allow MongoMapper logging configuration to come from mongo.yml

This tiny patch allows different loggers (or no logger if set to nil) to be configured inside mongo.yml without resorting to dreadful hacks[1]. I have seen other solutions on the 'net which suggest making a new, manual MongoMapper connection in an initializer, but since I use Replication Sets I didn't want to uglify my code by duplicating ReplSetConnections everywhere.

(See patch comments in GitHub for usage examples.)

[1] Uses eval, which some may consider a 'dreadful hack', but it works well here.