bullet 7.1.3 → 7.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68fdd5b4a91b98bb9fa4399088979b48a0e07432f268df9f0116b413433f8e89
4
- data.tar.gz: d7832e74768e19a93355b7d67341cebedde9f14048b331b91564ed9b218f3a4d
3
+ metadata.gz: 5f9b086db84fa8fdafa36938f0b7bf8f54d7a9c2602df6eb1359fb8754c73e99
4
+ data.tar.gz: 10b7f19f4b16f083bda3fb76c79ed7f46511e9be1f64a11b80f8b3560a93ace2
5
5
  SHA512:
6
- metadata.gz: 2a8ec0d54d2d0557793b1ad53b571ff5c04345d0e699d4052649b96f08ac911d5a200058fd9c13ee3ef342da65e14229f99e6cdc6fdab65668e468a062b1debe
7
- data.tar.gz: 4c2606728e7e84f80dbbdfc66c34510825d4b365204718a1eaaf3a42247ff9c8708d5be321ae07aad95f0ddc3e57e97961327d58f1dced9912a7c26822584b54
6
+ metadata.gz: 35caac02b6152db8d67dbe2ea35df8d2f60171f4855eb12143edf64b76fdb14bc52b59e4d2eb730d57ed5e84d7c7d98cda297e039a62bc857cd0a00b765b1e4c
7
+ data.tar.gz: ad948041bbf2b075de093c9e751118e0b44e1196feb43a95073f6f6b036944f144233374f0142af0add48150cb6735af458713c7c684f6fe7955a492caf67f80
data/CHANGELOG.md CHANGED
@@ -1,8 +1,12 @@
1
1
  ## Next Release
2
2
 
3
+ ## 7.1.4 (11/17/2023)
4
+
5
+ * Call association also on through reflection
6
+
3
7
  ## 7.1.3 (11/05/2023)
4
8
 
5
- * Call NPlusOneQuery's call_association when calling count on collectino assocation
9
+ * Call NPlusOneQuery's call_association when calling count on collection assocation
6
10
 
7
11
  ## 7.1.2 (10/13/2023)
8
12
 
@@ -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
- Bullet::Detector::Association.add_object_associations(record, associations)
112
- Bullet::Detector::NPlusOneQuery.call_association(record, associations)
113
- @bullet_eager_loadings[record.class] ||= {}
114
- @bullet_eager_loadings[record.class][record] ||= Set.new
115
- @bullet_eager_loadings[record.class][record] << associations
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
- Bullet::Detector::Association.add_object_associations(record, associations)
115
- Bullet::Detector::NPlusOneQuery.call_association(record, associations)
116
- @bullet_eager_loadings[record.class] ||= {}
117
- @bullet_eager_loadings[record.class][record] ||= Set.new
118
- @bullet_eager_loadings[record.class][record] << associations
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
- Bullet::Detector::Association.add_object_associations(ar_parent, associations)
134
- Bullet::Detector::NPlusOneQuery.call_association(ar_parent, associations)
135
- @bullet_eager_loadings[ar_parent.class] ||= {}
136
- @bullet_eager_loadings[ar_parent.class][ar_parent] ||= Set.new
137
- @bullet_eager_loadings[ar_parent.class][ar_parent] << associations
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
- Bullet::Detector::Association.add_object_associations(record, associations)
152
- Bullet::Detector::NPlusOneQuery.call_association(record, associations)
153
- @bullet_eager_loadings[record.class] ||= {}
154
- @bullet_eager_loadings[record.class][record] ||= Set.new
155
- @bullet_eager_loadings[record.class][record] << associations
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
- Bullet::Detector::Association.add_object_associations(ar_parent, associations)
143
- Bullet::Detector::NPlusOneQuery.call_association(ar_parent, associations)
144
- @bullet_eager_loadings[ar_parent.class] ||= {}
145
- @bullet_eager_loadings[ar_parent.class][ar_parent] ||= Set.new
146
- @bullet_eager_loadings[ar_parent.class][ar_parent] << associations
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
- Bullet::Detector::Association.add_object_associations(record, associations)
161
- Bullet::Detector::NPlusOneQuery.call_association(record, associations)
162
- @bullet_eager_loadings[record.class] ||= {}
163
- @bullet_eager_loadings[record.class][record] ||= Set.new
164
- @bullet_eager_loadings[record.class][record] << associations
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
- Bullet::Detector::Association.add_object_associations(ar_parent, associations)
106
- Bullet::Detector::NPlusOneQuery.call_association(ar_parent, associations)
107
- @bullet_eager_loadings[ar_parent.class] ||= {}
108
- @bullet_eager_loadings[ar_parent.class][ar_parent] ||= Set.new
109
- @bullet_eager_loadings[ar_parent.class][ar_parent] << associations
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
- Bullet::Detector::Association.add_object_associations(record, associations)
124
- Bullet::Detector::NPlusOneQuery.call_association(record, associations)
125
- @bullet_eager_loadings[record.class] ||= {}
126
- @bullet_eager_loadings[record.class][record] ||= Set.new
127
- @bullet_eager_loadings[record.class][record] << associations
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
- Bullet::Detector::Association.add_object_associations(ar_parent, associations)
133
- Bullet::Detector::NPlusOneQuery.call_association(ar_parent, associations)
134
- @bullet_eager_loadings[ar_parent.class] ||= {}
135
- @bullet_eager_loadings[ar_parent.class][ar_parent] ||= Set.new
136
- @bullet_eager_loadings[ar_parent.class][ar_parent] << associations
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
- Bullet::Detector::Association.add_object_associations(record, associations)
151
- Bullet::Detector::NPlusOneQuery.call_association(record, associations)
152
- @bullet_eager_loadings[record.class] ||= {}
153
- @bullet_eager_loadings[record.class][record] ||= Set.new
154
- @bullet_eager_loadings[record.class][record] << associations
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
- Bullet::Detector::Association.add_object_associations(ar_parent, associations)
133
- Bullet::Detector::NPlusOneQuery.call_association(ar_parent, associations)
134
- @bullet_eager_loadings[ar_parent.class] ||= {}
135
- @bullet_eager_loadings[ar_parent.class][ar_parent] ||= Set.new
136
- @bullet_eager_loadings[ar_parent.class][ar_parent] << associations
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
- Bullet::Detector::Association.add_object_associations(record, associations)
151
- Bullet::Detector::NPlusOneQuery.call_association(record, associations)
152
- @bullet_eager_loadings[record.class] ||= {}
153
- @bullet_eager_loadings[record.class][record] ||= Set.new
154
- @bullet_eager_loadings[record.class][record] << associations
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
- Bullet::Detector::Association.add_object_associations(ar_parent, associations)
142
- Bullet::Detector::NPlusOneQuery.call_association(ar_parent, associations)
143
- @bullet_eager_loadings[ar_parent.class] ||= {}
144
- @bullet_eager_loadings[ar_parent.class][ar_parent] ||= Set.new
145
- @bullet_eager_loadings[ar_parent.class][ar_parent] << associations
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
- Bullet::Detector::Association.add_object_associations(record, associations)
160
- Bullet::Detector::NPlusOneQuery.call_association(record, associations)
161
- @bullet_eager_loadings[record.class] ||= {}
162
- @bullet_eager_loadings[record.class][record] ||= Set.new
163
- @bullet_eager_loadings[record.class][record] << associations
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
- Bullet::Detector::Association.add_object_associations(ar_parent, associations)
142
- Bullet::Detector::NPlusOneQuery.call_association(ar_parent, associations)
143
- @bullet_eager_loadings[ar_parent.class] ||= {}
144
- @bullet_eager_loadings[ar_parent.class][ar_parent] ||= Set.new
145
- @bullet_eager_loadings[ar_parent.class][ar_parent] << associations
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
- Bullet::Detector::Association.add_object_associations(record, associations)
160
- Bullet::Detector::NPlusOneQuery.call_association(record, associations)
161
- @bullet_eager_loadings[record.class] ||= {}
162
- @bullet_eager_loadings[record.class][record] ||= Set.new
163
- @bullet_eager_loadings[record.class][record] << associations
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bullet
4
- VERSION = '7.1.3'
4
+ VERSION = '7.1.4'
5
5
  end
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.3
4
+ version: 7.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-05 00:00:00.000000000 Z
11
+ date: 2023-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport