Module: DatabaseRecorder::Core
- Defined in:
- lib/database_recorder/core.rb
Class Method Summary collapse
Class Method Details
.log_query(sql, source = nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/database_recorder/core.rb', line 7 def log_query(sql, source = nil) log = case DatabaseRecorder::Config.print_queries when true then "[DB] #{sql} [#{source}]" when :color then "[DB] #{CodeRay.scan(sql, :sql).term} [#{source}]" end puts log if log log end |
.setup ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/database_recorder/core.rb', line 18 def setup case DatabaseRecorder::Config.db_driver when :active_record then ActiveRecord::Recorder.setup when :mysql2 then Mysql2::Recorder.setup when :pg then PG::Recorder.setup end end |