bullet 4.14.3 → 4.14.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/bullet/active_record42.rb +17 -0
- data/lib/bullet/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbb4f34774c895c76a37a414109e24ca1217a2a5
|
4
|
+
data.tar.gz: bb7632755a33243163cfccd5285fd305c74adac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e09a8384a358f7db6f3fee7b94a613af8f08ee0e4079394a595f794737f8b397e80c3ac76f0808e8d1c3993e14c97a65162497baad8652b130f76d69646b55c
|
7
|
+
data.tar.gz: 904ed8a5c66a7d2d9479f0e4d82246d0f1f818548bbcfc33bc13eaf4b8e42dc2ce75fb4481741c9ae5597fcb6f84528b1671eb9bfe46be8985d20a9f2917acd2
|
data/CHANGELOG.md
CHANGED
@@ -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.
|
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: 4.14.
|
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-
|
11
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|