Rails’ ActiveRecord displays the exact SQL queries it performs into the development log. It is inconvenient to watch this log while you’re working in the `script/console` environment, however, and most advice for redirecting that log to STDOUT seemed not to work. Thanks to [Jamis Buck](http://weblog.jamisbuck.org/2007/1/31/more-on-watching-activerecord “More on watching ActiveRecord”), though, the solution has come to light:
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.clear_active_connections!
The key is the clear_active_connections! call. ActiveRecord caches its logger for performance purposes, and if any ActiveRecord calls have happened before the console finishes loading, you can change the Base.logger until the end of time and never see the SQL logged as you expect.
Thanks! This is exactly what I was missing as well.
“http://www.gather.com/viewArticle.action?articleId=281474978833995 Thanks for that awesome posting. It saved MUCH time :-)
Corruptness of the software program within the machine makes some data files is suffered. Or an onslaught from a virus or Trojan horse infection back data recovery nyc (Class charges MS Word, MS PowerPoint, MS Access, Excel) MS Office back to the prototype file (. JPG, JPEG, Bmp, GIF, TIF, JPE. PNG).