37signals/marginalia — pull request #19 by ossareh (2013-06-17 23:42:14+00:00)
Title: support for forcing marginalia inclusion

Issue: Adding marginalia to systems which use AR plugins to manage replication and sharding results in no comments being appended to queries.

Context: AR replication libraries like [Octopus|https://github.com/tchandy/octopus] and [DBCharmer|https://github.com/kovyrin/db-charmer] give you Proxy objects back when you call `ActiveRecord::Base.connection.is_a?` - these Proxy objects then delegate to the correct Adapter.

Solution: I initially tried to avoid patching your gem, instead I looked to see whether these libraries were "doing it wrong". I think they're actually doing the right thing - this lead me to decide that giving users the ability to override the decision making is the right thing to do. That is "we're smart enough to know to use a non trivial piece of code like Octopus, we want to be smart enough to tell other pieces of software to do the right thing in these cases".