37signals/marginalia — pull request #13 by jasonkb (2013-03-14 18:30:29+00:00)
Title: Fully support Rails 3.1 adaptors, fix :line info

Hi all,

As Airbnb migrated to Rails 3.1, we found that SQL queries started being not annotated by marginalia. We also tried to enable line debug comments, but found that that didn't really work. Here are fixes for both.

1) In most Rails 3.1 adaptors, exec_query() is used more often than
execute(). exec_query() wasn't being monkey-patched by marginalia, so
most queries weren't annotated. I've manually the adapters, and they should all play nicely now with Rails 3.1, with the exception that queries made through PostgreSQLAdapter exec_delete won't get annotated.

2) Line info wasn't very helpful before because every request would have
the same line info because the line info was being generated once per
request, not once per query. This change makes it so the call stack is
examined on each query.