write sql queries to terminal

For debugging Active Record issues one has to look at queries which are being generated. This PR writes SQL queries to terminal.