db_debug 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,3 @@
1
- require 'active_record/connection_adapters/postgresql_adapter'
2
-
3
1
  class DbDebug
4
2
  module ActiveRecord
5
3
  module ConnectionAdapters
@@ -37,6 +35,4 @@ class DbDebug
37
35
  end
38
36
  end
39
37
  end
40
- end
41
-
42
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send(:include, DbDebug::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
38
+ end
@@ -1,5 +1,9 @@
1
1
  class DbDebug
2
2
  class Engine < ::Rails::Engine
3
3
  config.app_middleware.use DbDebug::Middleware
4
+
5
+ config.after_initialize do
6
+ ::ActiveRecord::Base.connection.class.send(:include, DbDebug::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
7
+ end
4
8
  end
5
9
  end
@@ -13,7 +13,11 @@ class DbDebug
13
13
 
14
14
  def self.log color, str
15
15
  code = COLOR_MAP[color]
16
- Rails.logger.debug "\033[0;#{code}m#{str}\033[0;#37m"
16
+ str = "\033[0;#{code}m#{str}\033[0;#37m"
17
+ Rails.logger.debug str
18
+ if defined? IRB
19
+ puts str
20
+ end
17
21
  end
18
22
 
19
23
  def self.determine_color count, time
@@ -1,3 +1,3 @@
1
1
  class DbDebug
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/db_debug.rb CHANGED
@@ -11,7 +11,7 @@ class DbDebug
11
11
  DbDebug.enabled = true
12
12
  DbDebug.count = opts[:count] || 0
13
13
  DbDebug.time = opts[:time] || 0
14
- DbDebug.verbose = opts[:verbose] || false
14
+ DbDebug.verbose = opts[:verbose].nil? ? true : opts[:verbose]
15
15
 
16
16
  res = yield
17
17
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db_debug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: