bullet 7.1.2 → 7.1.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 +3 -3
- data/lib/bullet/active_record4.rb +1 -0
- data/lib/bullet/active_record41.rb +1 -0
- data/lib/bullet/active_record42.rb +1 -0
- data/lib/bullet/active_record5.rb +4 -0
- data/lib/bullet/active_record52.rb +4 -0
- data/lib/bullet/active_record60.rb +4 -0
- data/lib/bullet/active_record61.rb +4 -0
- data/lib/bullet/active_record70.rb +4 -0
- data/lib/bullet/active_record71.rb +4 -0
- data/lib/bullet/ext/object.rb +2 -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: 68fdd5b4a91b98bb9fa4399088979b48a0e07432f268df9f0116b413433f8e89
|
4
|
+
data.tar.gz: d7832e74768e19a93355b7d67341cebedde9f14048b331b91564ed9b218f3a4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a8ec0d54d2d0557793b1ad53b571ff5c04345d0e699d4052649b96f08ac911d5a200058fd9c13ee3ef342da65e14229f99e6cdc6fdab65668e468a062b1debe
|
7
|
+
data.tar.gz: 4c2606728e7e84f80dbbdfc66c34510825d4b365204718a1eaaf3a42247ff9c8708d5be321ae07aad95f0ddc3e57e97961327d58f1dced9912a7c26822584b54
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -287,17 +287,17 @@ $ rails new test_bullet
|
|
287
287
|
$ cd test_bullet
|
288
288
|
$ rails g scaffold post name:string
|
289
289
|
$ rails g scaffold comment name:string post_id:integer
|
290
|
-
$ bundle exec
|
290
|
+
$ bundle exec rails db:migrate
|
291
291
|
```
|
292
292
|
|
293
293
|
2\. Change `app/models/post.rb` and `app/models/comment.rb`
|
294
294
|
|
295
295
|
```ruby
|
296
|
-
class Post <
|
296
|
+
class Post < ApplicationRecord
|
297
297
|
has_many :comments
|
298
298
|
end
|
299
299
|
|
300
|
-
class Comment <
|
300
|
+
class Comment < ApplicationRecord
|
301
301
|
belongs_to :post
|
302
302
|
end
|
303
303
|
```
|
@@ -181,6 +181,7 @@ module Bullet
|
|
181
181
|
def count(column_name = nil, options = {})
|
182
182
|
if Bullet.start?
|
183
183
|
Bullet::Detector::CounterCache.add_counter_cache(proxy_association.owner, proxy_association.reflection.name)
|
184
|
+
Bullet::Detector::NPlusOneQuery.call_association(proxy_association.owner, proxy_association.reflection.name)
|
184
185
|
end
|
185
186
|
super(column_name, options)
|
186
187
|
end
|
@@ -173,6 +173,7 @@ module Bullet
|
|
173
173
|
def count(column_name = nil, options = {})
|
174
174
|
if Bullet.start?
|
175
175
|
Bullet::Detector::CounterCache.add_counter_cache(proxy_association.owner, proxy_association.reflection.name)
|
176
|
+
Bullet::Detector::NPlusOneQuery.call_association(proxy_association.owner, proxy_association.reflection.name)
|
176
177
|
end
|
177
178
|
super(column_name, options)
|
178
179
|
end
|
@@ -238,6 +238,7 @@ module Bullet
|
|
238
238
|
def count(column_name = nil, options = {})
|
239
239
|
if Bullet.start?
|
240
240
|
Bullet::Detector::CounterCache.add_counter_cache(proxy_association.owner, proxy_association.reflection.name)
|
241
|
+
Bullet::Detector::NPlusOneQuery.call_association(proxy_association.owner, proxy_association.reflection.name)
|
241
242
|
end
|
242
243
|
super(column_name, options)
|
243
244
|
end
|
@@ -251,6 +251,10 @@ module Bullet
|
|
251
251
|
proxy_association.owner,
|
252
252
|
proxy_association.reflection.name
|
253
253
|
)
|
254
|
+
Bullet::Detector::NPlusOneQuery.call_association(
|
255
|
+
proxy_association.owner,
|
256
|
+
proxy_association.reflection.name
|
257
|
+
)
|
254
258
|
end
|
255
259
|
super(column_name)
|
256
260
|
end
|
@@ -278,6 +278,10 @@ module Bullet
|
|
278
278
|
proxy_association.owner,
|
279
279
|
proxy_association.reflection.name
|
280
280
|
)
|
281
|
+
Bullet::Detector::NPlusOneQuery.call_association(
|
282
|
+
proxy_association.owner,
|
283
|
+
proxy_association.reflection.name
|
284
|
+
)
|
281
285
|
end
|
282
286
|
super(column_name)
|
283
287
|
end
|
@@ -294,6 +294,10 @@ module Bullet
|
|
294
294
|
proxy_association.owner,
|
295
295
|
proxy_association.reflection.name
|
296
296
|
)
|
297
|
+
Bullet::Detector::NPlusOneQuery.call_association(
|
298
|
+
proxy_association.owner,
|
299
|
+
proxy_association.reflection.name
|
300
|
+
)
|
297
301
|
end
|
298
302
|
super(column_name)
|
299
303
|
end
|
@@ -294,6 +294,10 @@ module Bullet
|
|
294
294
|
proxy_association.owner,
|
295
295
|
proxy_association.reflection.name
|
296
296
|
)
|
297
|
+
Bullet::Detector::NPlusOneQuery.call_association(
|
298
|
+
proxy_association.owner,
|
299
|
+
proxy_association.reflection.name
|
300
|
+
)
|
297
301
|
end
|
298
302
|
super(column_name)
|
299
303
|
end
|
data/lib/bullet/ext/object.rb
CHANGED
@@ -24,6 +24,7 @@ class Object
|
|
24
24
|
def bullet_join_potential_composite_primary_key(primary_keys)
|
25
25
|
return send(primary_keys) unless primary_keys.is_a?(Enumerable)
|
26
26
|
|
27
|
-
primary_keys.map { |primary_key| send primary_key }
|
27
|
+
primary_keys.map { |primary_key| send primary_key }
|
28
|
+
.join(',')
|
28
29
|
end
|
29
30
|
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.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: 2023-
|
11
|
+
date: 2023-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|