Created
July 30, 2012 20:24
-
-
Save rtwomey/3209869 to your computer and use it in GitHub Desktop.
Print SQL from your ruby tests
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
Helpful debugging trick: | |
When running a focused test, sometimes it's useful to log the SQL generated by the test. Stick the following in your test: | |
ActiveRecord::Base.connection.instance_variable_set :@logger, Logger.new(STDOUT) | |
Rerun your focused test and bask in the loveliness that is your test's SQL. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment