finding the line of code corresponding to an SQL statement

Wondering if any one has suggestions for changing the log output such
that the line of code (and associated file) that resulted in a query
is output to the log file when running in the development env.

for example:

ActionTracker Load (0.016000)e[0m e[0;1mSELECT * FROM
action_trackers WHERE (name='topicviews' and entity_id=93 and
user_id=88) LIMIT 1e[0m
<- action_tracker.rb - line #45

Wondering if any one has suggestions for changing the log output such
that the line of code (and associated file) that resulted in a query
is output to the log file when running in the development env.

http://agilewebdevelopment.com/plugins/sql_logging

You could try using a custom logger like log4r, or attempt to
customize AR itself.

Check out:

http://terralien.com/projects/querytrace/

fantastic! exactly what I was looking for!