goldiloader 4.2.1 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/goldiloader/active_record_patches.rb +2 -16
- data/lib/goldiloader/compatibility.rb +0 -10
- data/lib/goldiloader/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5acb78ebf278d88e47a50d7f3c6c49f55bee48704eb115082b45d1421f84313
|
4
|
+
data.tar.gz: 4034b092560abca7b531f81485c850f366e79bb5f4996c0477dd1525921a2ef8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 433c75215165ab250d932c5e3307ec78777f45cb9a6c691dcb33386566ce211e65771808e81c95ab0d46fd0a786e41899fd418858c466503fe723828ba56858d
|
7
|
+
data.tar.gz: dc0947c73fd7c01697442dd717a0e43efe35fce6a87ab281d9b51f86ea6d1b192be53f6c25b975294d7896ac3d73f79701ea4ea1c8c0cfb1e01d39c31b6a8fd1
|
@@ -114,8 +114,7 @@ module Goldiloader
|
|
114
114
|
private
|
115
115
|
|
116
116
|
def eager_loadable?
|
117
|
-
klass && reflection.eager_loadable?(klass)
|
118
|
-
(::Goldiloader::Compatibility.destroyed_model_associations_eager_loadable? || !owner.destroyed?)
|
117
|
+
klass && reflection.eager_loadable?(klass)
|
119
118
|
end
|
120
119
|
|
121
120
|
def load_with_auto_include
|
@@ -173,20 +172,7 @@ module Goldiloader
|
|
173
172
|
def auto_include?
|
174
173
|
# Only auto include through associations if the target association is auto-loadable
|
175
174
|
through_association = owner.association(through_reflection.name)
|
176
|
-
|
177
|
-
|
178
|
-
# If the current association cannot be auto-included there is nothing we can do
|
179
|
-
return false unless auto_include_self
|
180
|
-
|
181
|
-
# If the through association can just be auto-included we're good
|
182
|
-
return true if through_association.auto_include?
|
183
|
-
|
184
|
-
# If the through association was already loaded and does not contain new, changed, or destroyed records
|
185
|
-
# we are also able to auto-include the association. It means it has only already been read or changes are
|
186
|
-
# already persisted.
|
187
|
-
through_association.loaded? && Array.wrap(through_association.target).none? do |record|
|
188
|
-
record.new_record? || record.changed? || record.destroyed?
|
189
|
-
end
|
175
|
+
through_association.auto_include? && super
|
190
176
|
end
|
191
177
|
end
|
192
178
|
::ActiveRecord::Associations::HasManyThroughAssociation.prepend(::Goldiloader::ThroughAssociationPatch)
|
@@ -3,16 +3,11 @@
|
|
3
3
|
module Goldiloader
|
4
4
|
module Compatibility
|
5
5
|
ACTIVE_RECORD_VERSION = ::Gem::Version.new(::ActiveRecord::VERSION::STRING).release
|
6
|
-
RAILS_5_2_0 = ACTIVE_RECORD_VERSION == ::Gem::Version.new('5.2.0')
|
7
6
|
|
8
7
|
def self.pre_rails_7?
|
9
8
|
::ActiveRecord::VERSION::MAJOR < 7
|
10
9
|
end
|
11
10
|
|
12
|
-
def self.rails_5_2?
|
13
|
-
::ActiveRecord::VERSION::MAJOR == 5 && ::ActiveRecord::VERSION::MINOR == 2
|
14
|
-
end
|
15
|
-
|
16
11
|
def self.rails_6_1?
|
17
12
|
::ActiveRecord::VERSION::MAJOR == 6 && ::ActiveRecord::VERSION::MINOR == 1
|
18
13
|
end
|
@@ -20,10 +15,5 @@ module Goldiloader
|
|
20
15
|
def self.rails_6_1_or_greater?
|
21
16
|
::ActiveRecord::VERSION::MAJOR > 6 || rails_6_1?
|
22
17
|
end
|
23
|
-
|
24
|
-
# See https://github.com/rails/rails/pull/32375
|
25
|
-
def self.destroyed_model_associations_eager_loadable?
|
26
|
-
!RAILS_5_2_0
|
27
|
-
end
|
28
18
|
end
|
29
19
|
end
|
data/lib/goldiloader/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goldiloader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Turkel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.1'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '7.2'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '6.1'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '7.2'
|
@@ -36,7 +36,7 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '6.1'
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '7.2'
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
49
|
+
version: '6.1'
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '7.2'
|
@@ -112,7 +112,7 @@ dependencies:
|
|
112
112
|
requirements:
|
113
113
|
- - ">="
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: '
|
115
|
+
version: '6.1'
|
116
116
|
- - "<"
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '7.2'
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
requirements:
|
123
123
|
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: '
|
125
|
+
version: '6.1'
|
126
126
|
- - "<"
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: '7.2'
|
@@ -258,7 +258,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
258
258
|
requirements:
|
259
259
|
- - ">="
|
260
260
|
- !ruby/object:Gem::Version
|
261
|
-
version: '
|
261
|
+
version: '3.0'
|
262
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
263
263
|
requirements:
|
264
264
|
- - ">="
|