Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
15 lines (13 sloc) 323 Bytes
# vim: ft=ruby:
def toggle_sql
if ActiveRecord::Base.logger
set_logger nil and return false
else
set_logger Logger.new(STDOUT) and return true
end
end
def set_logger(logger)
ActiveRecord::Base.logger = logger
ActiveRecord::Base.clear_active_connections!
end
set_logger nil # start with the normal logger