jit_preloader 1.0.4 → 2.0.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08fbd77fdcfc580733fbb24995cd80a1535bada8471f2dace6620ad000c25778'
|
4
|
+
data.tar.gz: bfb07a3212433bc5dd2a5a557ed05d0472f0ec227593a798a1b9442976815d57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7fe821295fc841a48992f4fa93bbc372516509435a49455bf9e37543173fe089714198eaa9f0c355cf656d5c2696160c4c82bd657fad79edb9961d5e13e49c7
|
7
|
+
data.tar.gz: 33ae22de3c658a714be7b5c61705dcb82bdc1d762af3ee0d4ed084d29c6c9e8b6685fa3a353756f653c3287806d1eb946beb95df532983ce85536a82a8fab7fa
|
File without changes
|
data/jit_preloader.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "activerecord", ">=
|
21
|
+
spec.add_dependency "activerecord", ">= 7", "< 8"
|
22
22
|
spec.add_dependency "activesupport"
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler"
|
@@ -33,11 +33,11 @@ module JitPreloadExtension
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
preloader_association = ActiveRecord::Associations::Preloader.new
|
37
|
-
records,
|
38
|
-
base_association,
|
39
|
-
preload_scope
|
40
|
-
).first
|
36
|
+
preloader_association = ActiveRecord::Associations::Preloader.new(
|
37
|
+
records: records,
|
38
|
+
associations: base_association,
|
39
|
+
scope: preload_scope
|
40
|
+
).call.first
|
41
41
|
|
42
42
|
records.each do |record|
|
43
43
|
record.jit_preload_scoped_relations ||= {}
|
@@ -4,19 +4,18 @@ module JitPreloader
|
|
4
4
|
attr_accessor :records
|
5
5
|
|
6
6
|
def self.attach(records)
|
7
|
-
new.tap do |loader|
|
8
|
-
loader.records = records.dup
|
7
|
+
new(records: records.dup, associations: nil).tap do |loader|
|
9
8
|
records.each do |record|
|
10
9
|
record.jit_preloader = loader
|
11
10
|
end
|
12
11
|
end
|
13
12
|
end
|
14
13
|
|
15
|
-
def jit_preload(
|
14
|
+
def jit_preload(associations)
|
16
15
|
# It is possible that the records array has multiple different classes (think single table inheritance).
|
17
16
|
# Thus, it is possible that some of the records don't have an association.
|
18
|
-
records_with_association = records.reject{|r| r.class.reflect_on_association(
|
19
|
-
|
17
|
+
records_with_association = records.reject{|r| r.class.reflect_on_association(associations).nil? }
|
18
|
+
self.class.new(records: records_with_association, associations: associations).call
|
20
19
|
end
|
21
20
|
|
22
21
|
# We do not want the jit_preloader to be dumpable
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jit_preloader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle d'Oliveira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '7'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '8'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '7'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '8'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: activesupport
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,7 +151,7 @@ executables: []
|
|
151
151
|
extensions: []
|
152
152
|
extra_rdoc_files: []
|
153
153
|
files:
|
154
|
-
- ".github/
|
154
|
+
- ".github/CODEOWNERS"
|
155
155
|
- ".github/workflows/gem-push.yml"
|
156
156
|
- ".gitignore"
|
157
157
|
- ".rspec"
|