sql_logging Updated for Edge Rails
I updated the sql_logging plug-in today to work on Edge Rails. Â The PostgreSQL adapter on Edge tries to load a different database driver, and explicitly loading it when the application isn’t using it causes a crash when the server starts. Â Today’s change reworks things by asking ActiveRecord what adapter it’s using and only loading the extensions for it.
One other change includes making PostgreSQL query statistics work on Rails 2.0. Â The adapter there prefers to call the execute method instead of query.
Things should still work on Rails 1.2, but I’m moving applications to 2.0 whenever possible, so I’ll rely on a bug report if something is broken.
Finally, I’ll leave with a little tip: statistics aren’t kept for queries that lack a name or look like Rails asking for schema information. Â If you have a significant amount of query work done using the raw connection (select_all or select_one), make sure you give the query a name so it can be tracked properly and show up in the top 10 list.
Get the plug-in from svn at http://svn.lightyearsoftware.com/svn/plugins/sql_logging.