bullet 6.0.1 → 6.0.2
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/Gemfile.rails-6.0 +1 -1
- data/README.md +1 -1
- data/lib/bullet/active_record60.rb +15 -1
- data/lib/bullet/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: 152296ae0c6092687f600a52f129bfa88688b6d5a96db52dd554dbe5db848b11
|
4
|
+
data.tar.gz: 65967b8561c27febdab5112572bd5bec8ea7e4d948028eefed843988cedcef99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 011db6a9187cbb7d1ce77f249e041b8dda64e8c5cae0ff528081878a3b117cd2180b28c394333504479572eed14701feeba0d4ffa565c235f2fda401b85bd1a0
|
7
|
+
data.tar.gz: 332e755d1304b832ccbb4da6c7d05109a11cd62056c0ec911d1346b04e49475cce35c93e8174ca80d5850fbfa8cecc2d6dc630f713d7e681c16d24fb9fac51bc
|
data/CHANGELOG.md
CHANGED
data/Gemfile.rails-6.0
CHANGED
data/README.md
CHANGED
@@ -84,6 +84,20 @@ module Bullet
|
|
84
84
|
end
|
85
85
|
end)
|
86
86
|
|
87
|
+
::ActiveRecord::Associations::Preloader::ThroughAssociation.prepend(Module.new do
|
88
|
+
def preloaded_records
|
89
|
+
if Bullet.start? && !defined?(@preloaded_records)
|
90
|
+
source_preloaders.each do |source_preloader|
|
91
|
+
reflection_name = source_preloader.send(:reflection).name
|
92
|
+
source_preloader.send(:owners).each do |owner|
|
93
|
+
Bullet::Detector::NPlusOneQuery.call_association(owner, reflection_name)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
super
|
98
|
+
end
|
99
|
+
end)
|
100
|
+
|
87
101
|
::ActiveRecord::FinderMethods.prepend(Module.new do
|
88
102
|
# add includes in scope
|
89
103
|
def find_with_associations
|
@@ -160,7 +174,7 @@ module Bullet
|
|
160
174
|
if Bullet.start?
|
161
175
|
if is_a? ::ActiveRecord::Associations::ThroughAssociation
|
162
176
|
Bullet::Detector::NPlusOneQuery.call_association(owner, reflection.through_reflection.name)
|
163
|
-
association = owner.association
|
177
|
+
association = owner.association(reflection.through_reflection.name)
|
164
178
|
Array(association.target).each do |through_record|
|
165
179
|
Bullet::Detector::NPlusOneQuery.call_association(through_record, source_reflection.name)
|
166
180
|
end
|
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: 6.0.
|
4
|
+
version: 6.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|