bullet 4.14.3 → 4.14.4

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
  SHA1:
3
- metadata.gz: dbe02316f8b3e0b61718c940420f189423c3f5f0
4
- data.tar.gz: 93db165a6618fb9c470081013e4b2f5fe002c602
3
+ metadata.gz: bbb4f34774c895c76a37a414109e24ca1217a2a5
4
+ data.tar.gz: bb7632755a33243163cfccd5285fd305c74adac0
5
5
  SHA512:
6
- metadata.gz: 6c9ec0b4e3c23e6de5f59f74cb9378f5db7c32a448a42d4304b2399c3762308bab649dffc7f86bd04aaf175946391df9658994a1a190fb2a64fb8ec5bd21dbb3
7
- data.tar.gz: 47451dec206f2d05aaa11466d8f6c063bbb9e3e9c03929d7dc8867b11e77be6871ee6a58f1f2b52435db3bb6854e913228dc9b310bf7dd78f5b968de5f042932
6
+ metadata.gz: 3e09a8384a358f7db6f3fee7b94a613af8f08ee0e4079394a595f794737f8b397e80c3ac76f0808e8d1c3993e14c97a65162497baad8652b130f76d69646b55c
7
+ data.tar.gz: 904ed8a5c66a7d2d9479f0e4d82246d0f1f818548bbcfc33bc13eaf4b8e42dc2ce75fb4481741c9ae5597fcb6f84528b1671eb9bfe46be8985d20a9f2917acd2
@@ -1,5 +1,9 @@
1
1
  # Next Release
2
2
 
3
+ ## 4.14.4
4
+
5
+ * Fix false N + 1 warnings on Rails 4.2
6
+
3
7
  ## 4.14.3
4
8
 
5
9
  * Fix false positive on create
@@ -2,6 +2,23 @@ module Bullet
2
2
  module ActiveRecord
3
3
  def self.enable
4
4
  require 'active_record'
5
+ ::ActiveRecord::Base.class_eval do
6
+ class <<self
7
+ alias_method :origin_find, :find
8
+ def find(*args)
9
+ result = origin_find(*args)
10
+ if result.is_a? Array
11
+ Bullet::Detector::NPlusOneQuery.add_possible_objects(result)
12
+ Bullet::Detector::CounterCache.add_possible_objects(result)
13
+ elsif result.is_a? ::ActiveRecord::Base
14
+ Bullet::Detector::NPlusOneQuery.add_impossible_object(result)
15
+ Bullet::Detector::CounterCache.add_impossible_object(result)
16
+ end
17
+ result
18
+ end
19
+ end
20
+ end
21
+
5
22
  ::ActiveRecord::Relation.class_eval do
6
23
  alias_method :origin_to_a, :to_a
7
24
  # if select a collection of objects, then these objects have possible to cause N+1 query.
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Bullet
3
- VERSION = "4.14.3"
3
+ VERSION = "4.14.4"
4
4
  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: 4.14.3
4
+ version: 4.14.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: 2015-02-01 00:00:00.000000000 Z
11
+ date: 2015-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport