activerecord-explainer 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/activerecord/explainer/subscriber.rb +4 -4
- data/lib/activerecord/explainer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28d6a376c3f0a1b95d63efafef3a04235da65d4ce681b00c4a4d14a76ec067fb
|
4
|
+
data.tar.gz: d9cdbe0d8357f2af7c6800a533313d85109b0c97a264db11178c3aa3c9112d16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a7f9e991b8d5dc4c47d9e5f6735422a3fc22f44e98d161d44a91091317b6f7ba913b7cb1836a5abf10d3bb1d36f3f390a56dbeb347d13e2c02126306c696841
|
7
|
+
data.tar.gz: 681b6a6a7633416f7dbb58eda761a37c6f4d79f3751ab644cdbb0726fb83c0e73a1db0bb70e8129c783eb40ba677de38d29f35f30b63d359c6dd08bdcf3faa42
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,7 @@ You can check every SQL EXPLAIN from development log, without :hand: executions.
|
|
8
8
|
|
9
9
|
It's no configuration, and you can puts SQL EXPLAIN of every queries to logs.
|
10
10
|
|
11
|
-
![](https://github.com/yhirano55/activerecord-explainer/blob/master/images/
|
11
|
+
![](https://github.com/yhirano55/activerecord-explainer/blob/master/images/v0.2.0.png?raw=true)
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
|
@@ -1,13 +1,13 @@
|
|
1
|
-
require 'active_support/
|
1
|
+
require 'active_support/log_subscriber'
|
2
2
|
|
3
3
|
module ActiveRecord
|
4
4
|
module Explainer
|
5
|
-
class Subscriber < ActiveSupport::
|
5
|
+
class Subscriber < ActiveSupport::LogSubscriber # :nodoc:
|
6
6
|
def sql(event)
|
7
7
|
payload = event.payload
|
8
8
|
return if ignore_payload?(payload) || !ActiveRecord::Base.connection.supports_explain?
|
9
9
|
|
10
|
-
|
10
|
+
debug exec_explain(sql: payload[:sql], binds: payload[:binds])
|
11
11
|
end
|
12
12
|
|
13
13
|
private
|
@@ -29,7 +29,7 @@ module ActiveRecord
|
|
29
29
|
end
|
30
30
|
msg << "\n"
|
31
31
|
msg << ActiveRecord::Base.connection.explain(sql, binds)
|
32
|
-
msg
|
32
|
+
color(msg, :yellow)
|
33
33
|
end
|
34
34
|
|
35
35
|
def render_bind(attr)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-explainer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoshiyuki Hirano
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|