bullet 5.4.2 → 5.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/bullet/active_record3.rb +7 -2
- data/lib/bullet/active_record3x.rb +7 -2
- data/lib/bullet/active_record4.rb +7 -2
- data/lib/bullet/active_record41.rb +7 -2
- data/lib/bullet/active_record42.rb +7 -2
- data/lib/bullet/active_record5.rb +7 -2
- data/lib/bullet/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db91b963b462abea2bcc844e823be6844b6e9619
|
4
|
+
data.tar.gz: 53743afe0b49e9cb886ab14f1fd486c1545aa9fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b5d3790ae95fd828af2bd4ce1c4b964ec906e1d2caf8a4220e9757f8e0a192af2078a1a2f4e2704b3700eed8f43f4fcb1d0e7638a3a47aa81dfeaf42f535384
|
7
|
+
data.tar.gz: 048266edcde0343713b05d3b726ecb318340c9d2e382877b1e697549b185f164933ba3761c10b2b2f991c1d9638b1f5a119e6bb8738f4da6034b6ed949e2a565
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -332,7 +332,7 @@ model: Post => associations: [comment]
|
|
332
332
|
|
333
333
|
which means there is a N+1 query from the Post object to its Comment association.
|
334
334
|
|
335
|
-
In the
|
335
|
+
In the meantime, there's a log appended into `log/bullet.log` file
|
336
336
|
|
337
337
|
```
|
338
338
|
2010-03-07 14:12:18[INFO] N+1 Query in /posts
|
@@ -11,8 +11,13 @@ module Bullet
|
|
11
11
|
result = origin_find_by_sql(sql)
|
12
12
|
if Bullet.start?
|
13
13
|
if result.is_a? Array
|
14
|
-
|
15
|
-
|
14
|
+
if result.size > 1
|
15
|
+
Bullet::Detector::NPlusOneQuery.add_possible_objects(result)
|
16
|
+
Bullet::Detector::CounterCache.add_possible_objects(result)
|
17
|
+
elsif result.size == 1
|
18
|
+
Bullet::Detector::NPlusOneQuery.add_impossible_object(result.first)
|
19
|
+
Bullet::Detector::CounterCache.add_impossible_object(result.first)
|
20
|
+
end
|
16
21
|
elsif result.is_a? ::ActiveRecord::Base
|
17
22
|
Bullet::Detector::NPlusOneQuery.add_impossible_object(result)
|
18
23
|
Bullet::Detector::CounterCache.add_impossible_object(result)
|
@@ -9,8 +9,13 @@ module Bullet
|
|
9
9
|
result = origin_find_by_sql(sql, binds)
|
10
10
|
if Bullet.start?
|
11
11
|
if result.is_a? Array
|
12
|
-
|
13
|
-
|
12
|
+
if result.size > 1
|
13
|
+
Bullet::Detector::NPlusOneQuery.add_possible_objects(result)
|
14
|
+
Bullet::Detector::CounterCache.add_possible_objects(result)
|
15
|
+
elsif result.size == 1
|
16
|
+
Bullet::Detector::NPlusOneQuery.add_impossible_object(result.first)
|
17
|
+
Bullet::Detector::CounterCache.add_impossible_object(result.first)
|
18
|
+
end
|
14
19
|
elsif result.is_a? ::ActiveRecord::Base
|
15
20
|
Bullet::Detector::NPlusOneQuery.add_impossible_object(result)
|
16
21
|
Bullet::Detector::CounterCache.add_impossible_object(result)
|
@@ -9,8 +9,13 @@ module Bullet
|
|
9
9
|
result = origin_find_by_sql(sql, binds)
|
10
10
|
if Bullet.start?
|
11
11
|
if result.is_a? Array
|
12
|
-
|
13
|
-
|
12
|
+
if result.size > 1
|
13
|
+
Bullet::Detector::NPlusOneQuery.add_possible_objects(result)
|
14
|
+
Bullet::Detector::CounterCache.add_possible_objects(result)
|
15
|
+
elsif result.size == 1
|
16
|
+
Bullet::Detector::NPlusOneQuery.add_impossible_object(result.first)
|
17
|
+
Bullet::Detector::CounterCache.add_impossible_object(result.first)
|
18
|
+
end
|
14
19
|
elsif result.is_a? ::ActiveRecord::Base
|
15
20
|
Bullet::Detector::NPlusOneQuery.add_impossible_object(result)
|
16
21
|
Bullet::Detector::CounterCache.add_impossible_object(result)
|
@@ -9,8 +9,13 @@ module Bullet
|
|
9
9
|
result = origin_find_by_sql(sql, binds)
|
10
10
|
if Bullet.start?
|
11
11
|
if result.is_a? Array
|
12
|
-
|
13
|
-
|
12
|
+
if result.size > 1
|
13
|
+
Bullet::Detector::NPlusOneQuery.add_possible_objects(result)
|
14
|
+
Bullet::Detector::CounterCache.add_possible_objects(result)
|
15
|
+
elsif result.size == 1
|
16
|
+
Bullet::Detector::NPlusOneQuery.add_impossible_object(result.first)
|
17
|
+
Bullet::Detector::CounterCache.add_impossible_object(result.first)
|
18
|
+
end
|
14
19
|
elsif result.is_a? ::ActiveRecord::Base
|
15
20
|
Bullet::Detector::NPlusOneQuery.add_impossible_object(result)
|
16
21
|
Bullet::Detector::CounterCache.add_impossible_object(result)
|
@@ -24,8 +24,13 @@ module Bullet
|
|
24
24
|
result = origin_find_by_sql(sql, binds)
|
25
25
|
if Bullet.start?
|
26
26
|
if result.is_a? Array
|
27
|
-
|
28
|
-
|
27
|
+
if result.size > 1
|
28
|
+
Bullet::Detector::NPlusOneQuery.add_possible_objects(result)
|
29
|
+
Bullet::Detector::CounterCache.add_possible_objects(result)
|
30
|
+
elsif result.size == 1
|
31
|
+
Bullet::Detector::NPlusOneQuery.add_impossible_object(result.first)
|
32
|
+
Bullet::Detector::CounterCache.add_impossible_object(result.first)
|
33
|
+
end
|
29
34
|
elsif result.is_a? ::ActiveRecord::Base
|
30
35
|
Bullet::Detector::NPlusOneQuery.add_impossible_object(result)
|
31
36
|
Bullet::Detector::CounterCache.add_impossible_object(result)
|
@@ -25,8 +25,13 @@ module Bullet
|
|
25
25
|
result = origin_find_by_sql(sql, binds, preparable: nil)
|
26
26
|
if Bullet.start?
|
27
27
|
if result.is_a? Array
|
28
|
-
|
29
|
-
|
28
|
+
if result.size > 1
|
29
|
+
Bullet::Detector::NPlusOneQuery.add_possible_objects(result)
|
30
|
+
Bullet::Detector::CounterCache.add_possible_objects(result)
|
31
|
+
elsif result.size == 1
|
32
|
+
Bullet::Detector::NPlusOneQuery.add_impossible_object(result.first)
|
33
|
+
Bullet::Detector::CounterCache.add_impossible_object(result.first)
|
34
|
+
end
|
30
35
|
elsif result.is_a? ::ActiveRecord::Base
|
31
36
|
Bullet::Detector::NPlusOneQuery.add_impossible_object(result)
|
32
37
|
Bullet::Detector::CounterCache.add_impossible_object(result)
|
data/lib/bullet/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.4.
|
4
|
+
version: 5.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|