bullet 7.1.3 → 7.1.5
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 +9 -1
- data/lib/bullet/active_record4.rb +11 -6
- data/lib/bullet/active_record41.rb +11 -6
- data/lib/bullet/active_record42.rb +22 -12
- data/lib/bullet/active_record5.rb +22 -12
- data/lib/bullet/active_record52.rb +22 -12
- data/lib/bullet/active_record60.rb +22 -12
- data/lib/bullet/active_record61.rb +22 -12
- data/lib/bullet/active_record70.rb +22 -12
- data/lib/bullet/active_record71.rb +22 -12
- data/lib/bullet/mongoid8x.rb +4 -4
- data/lib/bullet/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ab16fc9ca893dbbc4fe755f9abe72e769f2e03b8405edf3189f0b92a17a75b5
|
4
|
+
data.tar.gz: 1072d72f4e58e28fa6e1a9f6337980e34a07897a146e3d9d5b060fa7e7923816
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10b11f86e3f57dfe5e58b64b384f90b86eb98ed71768c077f07af802b0a1646c4ddbb2bca876e8ff8a5ecd9a8dc008a41cece6c4c26819e04c386855ffd3d23d
|
7
|
+
data.tar.gz: 12629a5920c40d5471a2737d6b9ac0148b852127f796b2534a5cf87958ad24a5d69dfdc9c6cd7b4a66f807f492884a32be5af19cbeee7f364515d1f213a97882
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
## Next Release
|
2
2
|
|
3
|
+
## 7.1.5 (01/05/2024)
|
4
|
+
|
5
|
+
* Fix mongoid8
|
6
|
+
|
7
|
+
## 7.1.4 (11/17/2023)
|
8
|
+
|
9
|
+
* Call association also on through reflection
|
10
|
+
|
3
11
|
## 7.1.3 (11/05/2023)
|
4
12
|
|
5
|
-
* Call NPlusOneQuery's call_association when calling count on
|
13
|
+
* Call NPlusOneQuery's call_association when calling count on collection assocation
|
6
14
|
|
7
15
|
## 7.1.2 (10/13/2023)
|
8
16
|
|
@@ -107,12 +107,17 @@ module Bullet
|
|
107
107
|
result = origin_construct_association(record, join, row)
|
108
108
|
|
109
109
|
if Bullet.start?
|
110
|
-
associations = join.reflection.name
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
110
|
+
associations = [join.reflection.name]
|
111
|
+
if join.reflection.nested?
|
112
|
+
associations << join.reflection.through_reflection.name
|
113
|
+
end
|
114
|
+
associations.each do |association|
|
115
|
+
Bullet::Detector::Association.add_object_associations(record, association)
|
116
|
+
Bullet::Detector::NPlusOneQuery.call_association(record, association)
|
117
|
+
@bullet_eager_loadings[record.class] ||= {}
|
118
|
+
@bullet_eager_loadings[record.class][record] ||= Set.new
|
119
|
+
@bullet_eager_loadings[record.class][record] << association
|
120
|
+
end
|
116
121
|
end
|
117
122
|
|
118
123
|
result
|
@@ -110,12 +110,17 @@ module Bullet
|
|
110
110
|
result = origin_construct_model(record, node, row, model_cache, id, aliases)
|
111
111
|
|
112
112
|
if Bullet.start?
|
113
|
-
associations = node.reflection.name
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
113
|
+
associations = [node.reflection.name]
|
114
|
+
if node.reflection.nested?
|
115
|
+
associations << node.reflection.through_reflection.name
|
116
|
+
end
|
117
|
+
associations.each do |association|
|
118
|
+
Bullet::Detector::Association.add_object_associations(record, association)
|
119
|
+
Bullet::Detector::NPlusOneQuery.call_association(record, association)
|
120
|
+
@bullet_eager_loadings[record.class] ||= {}
|
121
|
+
@bullet_eager_loadings[record.class][record] ||= Set.new
|
122
|
+
@bullet_eager_loadings[record.class][record] << association
|
123
|
+
end
|
119
124
|
end
|
120
125
|
|
121
126
|
result
|
@@ -129,12 +129,17 @@ module Bullet
|
|
129
129
|
id = row[key]
|
130
130
|
next unless id.nil?
|
131
131
|
|
132
|
-
associations = node.reflection.name
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
132
|
+
associations = [node.reflection.name]
|
133
|
+
if node.reflection.nested?
|
134
|
+
associations << node.reflection.through_reflection.name
|
135
|
+
end
|
136
|
+
associations.each do |association|
|
137
|
+
Bullet::Detector::Association.add_object_associations(ar_parent, association)
|
138
|
+
Bullet::Detector::NPlusOneQuery.call_association(ar_parent, association)
|
139
|
+
@bullet_eager_loadings[ar_parent.class] ||= {}
|
140
|
+
@bullet_eager_loadings[ar_parent.class][ar_parent] ||= Set.new
|
141
|
+
@bullet_eager_loadings[ar_parent.class][ar_parent] << association
|
142
|
+
end
|
138
143
|
end
|
139
144
|
end
|
140
145
|
end
|
@@ -147,12 +152,17 @@ module Bullet
|
|
147
152
|
result = origin_construct_model(record, node, row, model_cache, id, aliases)
|
148
153
|
|
149
154
|
if Bullet.start?
|
150
|
-
associations = node.reflection.name
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
155
|
+
associations = [node.reflection.name]
|
156
|
+
if node.reflection.nested?
|
157
|
+
associations << node.reflection.through_reflection.name
|
158
|
+
end
|
159
|
+
associations.each do |association|
|
160
|
+
Bullet::Detector::Association.add_object_associations(record, association)
|
161
|
+
Bullet::Detector::NPlusOneQuery.call_association(record, association)
|
162
|
+
@bullet_eager_loadings[record.class] ||= {}
|
163
|
+
@bullet_eager_loadings[record.class][record] ||= Set.new
|
164
|
+
@bullet_eager_loadings[record.class][record] << association
|
165
|
+
end
|
156
166
|
end
|
157
167
|
|
158
168
|
result
|
@@ -138,12 +138,17 @@ module Bullet
|
|
138
138
|
id = row[key]
|
139
139
|
next unless id.nil?
|
140
140
|
|
141
|
-
associations = node.reflection.name
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
141
|
+
associations = [node.reflection.name]
|
142
|
+
if node.reflection.through_reflection?
|
143
|
+
associations << node.reflection.through_reflection.name
|
144
|
+
end
|
145
|
+
associations.each do |association|
|
146
|
+
Bullet::Detector::Association.add_object_associations(ar_parent, association)
|
147
|
+
Bullet::Detector::NPlusOneQuery.call_association(ar_parent, association)
|
148
|
+
@bullet_eager_loadings[ar_parent.class] ||= {}
|
149
|
+
@bullet_eager_loadings[ar_parent.class][ar_parent] ||= Set.new
|
150
|
+
@bullet_eager_loadings[ar_parent.class][ar_parent] << association
|
151
|
+
end
|
147
152
|
end
|
148
153
|
end
|
149
154
|
end
|
@@ -156,12 +161,17 @@ module Bullet
|
|
156
161
|
result = super
|
157
162
|
|
158
163
|
if Bullet.start?
|
159
|
-
associations = node.reflection.name
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
164
|
+
associations = [node.reflection.name]
|
165
|
+
if node.reflection.through_reflection?
|
166
|
+
associations << node.reflection.through_reflection.name
|
167
|
+
end
|
168
|
+
associations.each do |association|
|
169
|
+
Bullet::Detector::Association.add_object_associations(record, association)
|
170
|
+
Bullet::Detector::NPlusOneQuery.call_association(record, association)
|
171
|
+
@bullet_eager_loadings[record.class] ||= {}
|
172
|
+
@bullet_eager_loadings[record.class][record] ||= Set.new
|
173
|
+
@bullet_eager_loadings[record.class][record] << association
|
174
|
+
end
|
165
175
|
end
|
166
176
|
|
167
177
|
result
|
@@ -101,12 +101,17 @@ module Bullet
|
|
101
101
|
id = row[key]
|
102
102
|
next unless id.nil?
|
103
103
|
|
104
|
-
associations = node.reflection.name
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
104
|
+
associations = [node.reflection.name]
|
105
|
+
if node.reflection.through_reflection?
|
106
|
+
associations << node.reflection.through_reflection.name
|
107
|
+
end
|
108
|
+
associations.each do |association|
|
109
|
+
Bullet::Detector::Association.add_object_associations(ar_parent, association)
|
110
|
+
Bullet::Detector::NPlusOneQuery.call_association(ar_parent, association)
|
111
|
+
@bullet_eager_loadings[ar_parent.class] ||= {}
|
112
|
+
@bullet_eager_loadings[ar_parent.class][ar_parent] ||= Set.new
|
113
|
+
@bullet_eager_loadings[ar_parent.class][ar_parent] << association
|
114
|
+
end
|
110
115
|
end
|
111
116
|
end
|
112
117
|
end
|
@@ -119,12 +124,17 @@ module Bullet
|
|
119
124
|
result = super
|
120
125
|
|
121
126
|
if Bullet.start?
|
122
|
-
associations = node.reflection.name
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
127
|
+
associations = [node.reflection.name]
|
128
|
+
if node.reflection.through_reflection?
|
129
|
+
associations << node.reflection.through_reflection.name
|
130
|
+
end
|
131
|
+
associations.each do |association|
|
132
|
+
Bullet::Detector::Association.add_object_associations(record, association)
|
133
|
+
Bullet::Detector::NPlusOneQuery.call_association(record, association)
|
134
|
+
@bullet_eager_loadings[record.class] ||= {}
|
135
|
+
@bullet_eager_loadings[record.class][record] ||= Set.new
|
136
|
+
@bullet_eager_loadings[record.class][record] << association
|
137
|
+
end
|
128
138
|
end
|
129
139
|
|
130
140
|
result
|
@@ -128,12 +128,17 @@ module Bullet
|
|
128
128
|
id = row[key]
|
129
129
|
next unless id.nil?
|
130
130
|
|
131
|
-
associations = node.reflection.name
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
131
|
+
associations = [node.reflection.name]
|
132
|
+
if node.reflection.through_reflection?
|
133
|
+
associations << node.reflection.through_reflection.name
|
134
|
+
end
|
135
|
+
associations.each do |association|
|
136
|
+
Bullet::Detector::Association.add_object_associations(ar_parent, association)
|
137
|
+
Bullet::Detector::NPlusOneQuery.call_association(ar_parent, association)
|
138
|
+
@bullet_eager_loadings[ar_parent.class] ||= {}
|
139
|
+
@bullet_eager_loadings[ar_parent.class][ar_parent] ||= Set.new
|
140
|
+
@bullet_eager_loadings[ar_parent.class][ar_parent] << association
|
141
|
+
end
|
137
142
|
end
|
138
143
|
end
|
139
144
|
end
|
@@ -146,12 +151,17 @@ module Bullet
|
|
146
151
|
result = super
|
147
152
|
|
148
153
|
if Bullet.start?
|
149
|
-
associations = node.reflection.name
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
154
|
+
associations = [node.reflection.name]
|
155
|
+
if node.reflection.through_reflection?
|
156
|
+
associations << node.reflection.through_reflection.name
|
157
|
+
end
|
158
|
+
associations.each do |association|
|
159
|
+
Bullet::Detector::Association.add_object_associations(record, association)
|
160
|
+
Bullet::Detector::NPlusOneQuery.call_association(record, association)
|
161
|
+
@bullet_eager_loadings[record.class] ||= {}
|
162
|
+
@bullet_eager_loadings[record.class][record] ||= Set.new
|
163
|
+
@bullet_eager_loadings[record.class][record] << association
|
164
|
+
end
|
155
165
|
end
|
156
166
|
|
157
167
|
result
|
@@ -128,12 +128,17 @@ module Bullet
|
|
128
128
|
id = row[key]
|
129
129
|
next unless id.nil?
|
130
130
|
|
131
|
-
associations = node.reflection.name
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
131
|
+
associations = [node.reflection.name]
|
132
|
+
if node.reflection.through_reflection?
|
133
|
+
associations << node.reflection.through_reflection.name
|
134
|
+
end
|
135
|
+
associations.each do |association|
|
136
|
+
Bullet::Detector::Association.add_object_associations(ar_parent, association)
|
137
|
+
Bullet::Detector::NPlusOneQuery.call_association(ar_parent, association)
|
138
|
+
@bullet_eager_loadings[ar_parent.class] ||= {}
|
139
|
+
@bullet_eager_loadings[ar_parent.class][ar_parent] ||= Set.new
|
140
|
+
@bullet_eager_loadings[ar_parent.class][ar_parent] << association
|
141
|
+
end
|
137
142
|
end
|
138
143
|
end
|
139
144
|
end
|
@@ -146,12 +151,17 @@ module Bullet
|
|
146
151
|
result = super
|
147
152
|
|
148
153
|
if Bullet.start?
|
149
|
-
associations = node.reflection.name
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
154
|
+
associations = [node.reflection.name]
|
155
|
+
if node.reflection.through_reflection?
|
156
|
+
associations << node.reflection.through_reflection.name
|
157
|
+
end
|
158
|
+
associations.each do |association|
|
159
|
+
Bullet::Detector::Association.add_object_associations(record, association)
|
160
|
+
Bullet::Detector::NPlusOneQuery.call_association(record, association)
|
161
|
+
@bullet_eager_loadings[record.class] ||= {}
|
162
|
+
@bullet_eager_loadings[record.class][record] ||= Set.new
|
163
|
+
@bullet_eager_loadings[record.class][record] << association
|
164
|
+
end
|
155
165
|
end
|
156
166
|
|
157
167
|
result
|
@@ -137,12 +137,17 @@ module Bullet
|
|
137
137
|
id = row[key]
|
138
138
|
next unless id.nil?
|
139
139
|
|
140
|
-
associations = node.reflection.name
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
140
|
+
associations = [node.reflection.name]
|
141
|
+
if node.reflection.through_reflection?
|
142
|
+
associations << node.reflection.through_reflection.name
|
143
|
+
end
|
144
|
+
associations.each do |association|
|
145
|
+
Bullet::Detector::Association.add_object_associations(ar_parent, association)
|
146
|
+
Bullet::Detector::NPlusOneQuery.call_association(ar_parent, association)
|
147
|
+
@bullet_eager_loadings[ar_parent.class] ||= {}
|
148
|
+
@bullet_eager_loadings[ar_parent.class][ar_parent] ||= Set.new
|
149
|
+
@bullet_eager_loadings[ar_parent.class][ar_parent] << association
|
150
|
+
end
|
146
151
|
end
|
147
152
|
end
|
148
153
|
end
|
@@ -155,12 +160,17 @@ module Bullet
|
|
155
160
|
result = super
|
156
161
|
|
157
162
|
if Bullet.start?
|
158
|
-
associations = node.reflection.name
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
163
|
+
associations = [node.reflection.name]
|
164
|
+
if node.reflection.through_reflection?
|
165
|
+
associations << node.reflection.through_reflection.name
|
166
|
+
end
|
167
|
+
associations.each do |association|
|
168
|
+
Bullet::Detector::Association.add_object_associations(record, association)
|
169
|
+
Bullet::Detector::NPlusOneQuery.call_association(record, association)
|
170
|
+
@bullet_eager_loadings[record.class] ||= {}
|
171
|
+
@bullet_eager_loadings[record.class][record] ||= Set.new
|
172
|
+
@bullet_eager_loadings[record.class][record] << association
|
173
|
+
end
|
164
174
|
end
|
165
175
|
|
166
176
|
result
|
@@ -137,12 +137,17 @@ module Bullet
|
|
137
137
|
id = row[key]
|
138
138
|
next unless id.nil?
|
139
139
|
|
140
|
-
associations = node.reflection.name
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
140
|
+
associations = [node.reflection.name]
|
141
|
+
if node.reflection.through_reflection?
|
142
|
+
associations << node.reflection.through_reflection.name
|
143
|
+
end
|
144
|
+
associations.each do |association|
|
145
|
+
Bullet::Detector::Association.add_object_associations(ar_parent, association)
|
146
|
+
Bullet::Detector::NPlusOneQuery.call_association(ar_parent, association)
|
147
|
+
@bullet_eager_loadings[ar_parent.class] ||= {}
|
148
|
+
@bullet_eager_loadings[ar_parent.class][ar_parent] ||= Set.new
|
149
|
+
@bullet_eager_loadings[ar_parent.class][ar_parent] << association
|
150
|
+
end
|
146
151
|
end
|
147
152
|
end
|
148
153
|
end
|
@@ -155,12 +160,17 @@ module Bullet
|
|
155
160
|
result = super
|
156
161
|
|
157
162
|
if Bullet.start?
|
158
|
-
associations = node.reflection.name
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
163
|
+
associations = [node.reflection.name]
|
164
|
+
if node.reflection.through_reflection?
|
165
|
+
associations << node.reflection.through_reflection.name
|
166
|
+
end
|
167
|
+
associations.each do |association|
|
168
|
+
Bullet::Detector::Association.add_object_associations(record, association)
|
169
|
+
Bullet::Detector::NPlusOneQuery.call_association(record, association)
|
170
|
+
@bullet_eager_loadings[record.class] ||= {}
|
171
|
+
@bullet_eager_loadings[record.class][record] ||= Set.new
|
172
|
+
@bullet_eager_loadings[record.class][record] << association
|
173
|
+
end
|
164
174
|
end
|
165
175
|
|
166
176
|
result
|
data/lib/bullet/mongoid8x.rb
CHANGED
@@ -8,14 +8,14 @@ module Bullet
|
|
8
8
|
alias_method :origin_each, :each
|
9
9
|
alias_method :origin_eager_load, :eager_load
|
10
10
|
|
11
|
-
def first(
|
12
|
-
result = origin_first(
|
11
|
+
def first(limit = nil)
|
12
|
+
result = origin_first(limit)
|
13
13
|
Bullet::Detector::NPlusOneQuery.add_impossible_object(result) if result
|
14
14
|
result
|
15
15
|
end
|
16
16
|
|
17
|
-
def last(
|
18
|
-
result = origin_last(
|
17
|
+
def last(limit = nil)
|
18
|
+
result = origin_last(limit)
|
19
19
|
Bullet::Detector::NPlusOneQuery.add_impossible_object(result) if result
|
20
20
|
result
|
21
21
|
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: 7.1.
|
4
|
+
version: 7.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: 1.3.6
|
113
113
|
requirements: []
|
114
|
-
rubygems_version: 3.
|
114
|
+
rubygems_version: 3.5.3
|
115
115
|
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: help to kill N+1 queries and unused eager loading.
|