Created
April 4, 2013 21:11
-
-
Save bmorton/5314394 to your computer and use it in GitHub Desktop.
Throw this in an initializer to get stack traces of SQL queries.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveSupport::Notifications.subscribe "sql.active_record" do |name, start, finish, id, payload| | |
Rails.logger.debug "==============================================" | |
Rails.logger.debug "SQL: #{payload[:sql]}" | |
Rails.logger.debug "==============================================" | |
Rails.logger.debug caller.join("\n") | |
Rails.logger.debug "==============================================" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment