turning off ActiveRecord logging in the console

It’s sometimes quite annoying to have SQL queries clogging up the Rails console when you don’t need to see it. You Can turn it off by setting ActiveRecord’s logger to nil

old_logger = ActiveRecord::Base.logger
ActiveRecord::Base.logger = nil

You can of course turn it back on again.

ActiveRecord::Base.logger = old_logger