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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c62bb5eb8bdfdb62ce49a79609ce7665d6af8be0f7dede7361379597415dcd4
4
- data.tar.gz: 8da00673c07b79eb6dbf7b061aaf6dd0208fd0be841a96c3169ba919259fcf82
3
+ metadata.gz: 68fdd5b4a91b98bb9fa4399088979b48a0e07432f268df9f0116b413433f8e89
4
+ data.tar.gz: d7832e74768e19a93355b7d67341cebedde9f14048b331b91564ed9b218f3a4d
5
5
  SHA512:
6
- metadata.gz: f33ad269a72ba293680c65ed460ef4e598446eebf62c82d79879de03b3cb52098f27499cab681facec3fdc3a3d6f937d064c21621aefcc69edcf499a52680838
7
- data.tar.gz: 4a386c2bda2cdea90926ce9ff8bca0932954507ac4fa1e5986a356d869c3fb410b48708a5de843fb0e1f822f744ef1cf26dcecc9036ad3036f774ffad1c6e84e
6
+ metadata.gz: 2a8ec0d54d2d0557793b1ad53b571ff5c04345d0e699d4052649b96f08ac911d5a200058fd9c13ee3ef342da65e14229f99e6cdc6fdab65668e468a062b1debe
7
+ data.tar.gz: 4c2606728e7e84f80dbbdfc66c34510825d4b365204718a1eaaf3a42247ff9c8708d5be321ae07aad95f0ddc3e57e97961327d58f1dced9912a7c26822584b54
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## Next Release
2
2
 
3
+ ## 7.1.3 (11/05/2023)
4
+
5
+ * Call NPlusOneQuery's call_association when calling count on collectino assocation
6
+
3
7
  ## 7.1.2 (10/13/2023)
4
8
 
5
9
  * Handle Rails 7.1 composite primary keys
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 rake db:migrate
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 < ActiveRecord::Base
296
+ class Post < ApplicationRecord
297
297
  has_many :comments
298
298
  end
299
299
 
300
- class Comment < ActiveRecord::Base
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
@@ -269,6 +269,10 @@ module Bullet
269
269
  proxy_association.owner,
270
270
  proxy_association.reflection.name
271
271
  )
272
+ Bullet::Detector::NPlusOneQuery.call_association(
273
+ proxy_association.owner,
274
+ proxy_association.reflection.name
275
+ )
272
276
  end
273
277
  super
274
278
  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
283
287
  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
@@ -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 }.join(',')
27
+ primary_keys.map { |primary_key| send primary_key }
28
+ .join(',')
28
29
  end
29
30
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bullet
4
- VERSION = '7.1.2'
4
+ VERSION = '7.1.3'
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.2
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-10-13 00:00:00.000000000 Z
11
+ date: 2023-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport