bullet 4.12.0 → 4.13.0
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 +5 -1
- data/lib/bullet/active_record3.rb +6 -0
- data/lib/bullet/active_record3x.rb +6 -0
- data/lib/bullet/active_record4.rb +6 -0
- data/lib/bullet/active_record41.rb +6 -0
- data/lib/bullet/version.rb +1 -1
- data/spec/integration/active_record3/association_spec.rb +11 -0
- data/spec/integration/active_record4/association_spec.rb +11 -0
- 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: e90d569b3150f0988aeb2f614513e4603f231a92
|
4
|
+
data.tar.gz: 8106c975d3aa193772e6146757c2f55144f8205e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7fdb81048632cf1c99bf42680ce5c78ef8f605be770088d2d7f623f25663fb1a00e8f860775175791b54245f1a610430372d7402b35e29b4a636148052ef0e6
|
7
|
+
data.tar.gz: 12518c2cafae4fa1db72215e3d6430c1781f82601176db91edf5b7246f52305a9991f37f522517e71af3d4435b5159589efbc25379694e38c76726cedd85ffc0
|
data/CHANGELOG.md
CHANGED
@@ -103,6 +103,12 @@ module Bullet
|
|
103
103
|
Bullet::Detector::NPlusOneQuery.call_association(@owner, @reflection.name)
|
104
104
|
origin_empty?
|
105
105
|
end
|
106
|
+
|
107
|
+
alias_method :origin_include?, :include?
|
108
|
+
def include?(object)
|
109
|
+
Bullet::Detector::NPlusOneQuery.call_association(@owner, @reflection.name)
|
110
|
+
origin_include?(object)
|
111
|
+
end
|
106
112
|
end
|
107
113
|
|
108
114
|
::ActiveRecord::Associations::AssociationProxy.class_eval do
|
@@ -91,6 +91,12 @@ module Bullet
|
|
91
91
|
Bullet::Detector::NPlusOneQuery.call_association(@owner, @reflection.name)
|
92
92
|
origin_empty?
|
93
93
|
end
|
94
|
+
|
95
|
+
alias_method :origin_include?, :include?
|
96
|
+
def include?(object)
|
97
|
+
Bullet::Detector::NPlusOneQuery.call_association(@owner, @reflection.name)
|
98
|
+
origin_include?(object)
|
99
|
+
end
|
94
100
|
end
|
95
101
|
|
96
102
|
::ActiveRecord::Associations::SingularAssociation.class_eval do
|
@@ -91,6 +91,12 @@ module Bullet
|
|
91
91
|
Bullet::Detector::NPlusOneQuery.call_association(@owner, @reflection.name)
|
92
92
|
origin_empty?
|
93
93
|
end
|
94
|
+
|
95
|
+
alias_method :origin_include?, :include?
|
96
|
+
def include?(object)
|
97
|
+
Bullet::Detector::NPlusOneQuery.call_association(@owner, @reflection.name)
|
98
|
+
origin_include?(object)
|
99
|
+
end
|
94
100
|
end
|
95
101
|
|
96
102
|
::ActiveRecord::Associations::SingularAssociation.class_eval do
|
@@ -93,6 +93,12 @@ module Bullet
|
|
93
93
|
Bullet::Detector::NPlusOneQuery.call_association(@owner, @reflection.name)
|
94
94
|
origin_empty?
|
95
95
|
end
|
96
|
+
|
97
|
+
alias_method :origin_include?, :include?
|
98
|
+
def include?(object)
|
99
|
+
Bullet::Detector::NPlusOneQuery.call_association(@owner, @reflection.name)
|
100
|
+
origin_include?(object)
|
101
|
+
end
|
96
102
|
end
|
97
103
|
|
98
104
|
::ActiveRecord::Associations::SingularAssociation.class_eval do
|
data/lib/bullet/version.rb
CHANGED
@@ -61,6 +61,17 @@ if !mongoid? && active_record3?
|
|
61
61
|
|
62
62
|
expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :comments)
|
63
63
|
end
|
64
|
+
|
65
|
+
it "should detect non preload post => comments with include?" do
|
66
|
+
comment = Comment.last
|
67
|
+
Post.all.each do |post|
|
68
|
+
post.comments.include?(comment)
|
69
|
+
end
|
70
|
+
Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
|
71
|
+
expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
|
72
|
+
|
73
|
+
expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :comments)
|
74
|
+
end
|
64
75
|
end
|
65
76
|
|
66
77
|
context "category => posts => comments" do
|
@@ -61,6 +61,17 @@ if !mongoid? && active_record4?
|
|
61
61
|
|
62
62
|
expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :comments)
|
63
63
|
end
|
64
|
+
|
65
|
+
it "should detect non preload post => comments with include?" do
|
66
|
+
comment = Comment.last
|
67
|
+
Post.all.each do |post|
|
68
|
+
post.comments.include?(comment)
|
69
|
+
end
|
70
|
+
Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
|
71
|
+
expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
|
72
|
+
|
73
|
+
expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :comments)
|
74
|
+
end
|
64
75
|
end
|
65
76
|
|
66
77
|
context "category => posts => comments" do
|
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.
|
4
|
+
version: 4.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|