predictive_load 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 389078c86577ae35abeed91c62774ecf92924a19
4
- data.tar.gz: 1ba0d8068de6029ecc853ae92b3068f827c6c067
3
+ metadata.gz: e90bbf6f94ab919853192241e22b311e67202681
4
+ data.tar.gz: e7606fd33878084afdcd62ca317d428b62cd5b24
5
5
  SHA512:
6
- metadata.gz: 019bf857c563d681ac96c34bd97543c08046422ba8941d3441f5093297c13928e258b03194443749d4f6893394d7ab3b58eb1879aa03e6a751d5ab5f22330e5a
7
- data.tar.gz: 8f6e11a32d2d372a9ce43e12f8f32c0d1d2eba2ac24425fc553905023814c3cb4db5d1f739a3746abe54cdcef5ca760b2cd7a1db3806d4c9cd67a68a42fd9874
6
+ metadata.gz: 9c5344e844ebe9295b7865681dc1d7c91c2331fc180187d1f2a1a4da7da5784010dc2ccb1d565c3f939b6c6683199ee5a1e1591dcd696196ceed2b4829964fcd
7
+ data.tar.gz: 09d21270213b7c416d7fd8a18ff238ad61d41d1616d2fb1274b22670223d9a7c68da2bb0995375ff45b75e102f9449f50ccc4dd4ae7ebd00e377d177ce966049
@@ -12,7 +12,8 @@ module PredictiveLoad::ActiveRecordCollectionObservation
12
12
 
13
13
  def self.included(base)
14
14
  base.class_attribute :collection_observer
15
- base.alias_method_chain :to_a, :collection_observer
15
+ base.send(:alias_method, :to_a_without_collection_observer, :to_a)
16
+ base.send(:alias_method, :to_a, :to_a_with_collection_observer)
16
17
  end
17
18
 
18
19
  def to_a_with_collection_observer
@@ -35,7 +36,7 @@ module PredictiveLoad::ActiveRecordCollectionObservation
35
36
 
36
37
  # disable eager loading since includes + unscoped is broken on rails 4
37
38
  module UnscopedTracker
38
- if ActiveRecord::VERSION::MAJOR == 4
39
+ if ActiveRecord::VERSION::MAJOR >= 4
39
40
  def unscoped
40
41
  if block_given?
41
42
  begin
@@ -58,7 +59,8 @@ module PredictiveLoad::ActiveRecordCollectionObservation
58
59
  module AssociationNotification
59
60
 
60
61
  def self.included(base)
61
- base.alias_method_chain :load_target, :notification
62
+ base.send(:alias_method, :load_target_without_notification, :load_target)
63
+ base.send(:alias_method, :load_target, :load_target_with_notification)
62
64
  end
63
65
 
64
66
  def load_target_with_notification
@@ -80,7 +82,8 @@ module PredictiveLoad::ActiveRecordCollectionObservation
80
82
  module CollectionAssociationNotification
81
83
 
82
84
  def self.included(base)
83
- base.alias_method_chain :load_target, :notification
85
+ base.send(:alias_method, :load_target_without_notification, :load_target)
86
+ base.send(:alias_method, :load_target, :load_target_with_notification)
84
87
  end
85
88
 
86
89
  def load_target_with_notification
@@ -44,7 +44,7 @@ module PredictiveLoad
44
44
  protected
45
45
 
46
46
  def log_query_plan(association_name)
47
- log("detected n1 call on #{records.first.class.name}##{association_name}")
47
+ log("detected n+1 call on #{records.first.class.name}##{association_name}")
48
48
 
49
49
  # Detailed logging for first query
50
50
  if query_count(association_name) == 1
@@ -1,4 +1,5 @@
1
1
  module PredictiveLoad
2
+
2
3
  end
3
4
 
4
5
  klasses = [ActiveRecord::Associations::Builder::Association]
@@ -9,5 +10,9 @@ if ActiveRecord::VERSION::MAJOR == 3
9
10
  end
10
11
 
11
12
  klasses.each do |klass|
12
- klass.valid_options << :predictive_load
13
+ if ActiveRecord::VERSION::MAJOR < 5
14
+ klass.valid_options << :predictive_load
15
+ else
16
+ klass::VALID_OPTIONS << :predictive_load
17
+ end
13
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: predictive_load
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Chapweske
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-04 00:00:00.000000000 Z
11
+ date: 2016-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 3.2.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 4.3.0
22
+ version: '5.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 3.2.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 4.3.0
32
+ version: '5.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: minitest
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -128,6 +128,20 @@ dependencies:
128
128
  - - ">="
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
+ - !ruby/object:Gem::Dependency
132
+ name: byebug
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
131
145
  description: Predictive loader
132
146
  email:
133
147
  - eac@zendesk.com
@@ -162,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
176
  version: '0'
163
177
  requirements: []
164
178
  rubyforge_project:
165
- rubygems_version: 2.2.2
179
+ rubygems_version: 2.4.5.1
166
180
  signing_key:
167
181
  specification_version: 4
168
182
  summary: ''