jit_preloader 1.0.2 → 1.0.3

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: 2b1347f4a6e1db52e169d10cb83f6c365867f04882c873c9d6fa11c72553c385
4
- data.tar.gz: 90fd4451da01e450c484ff23eec4ac08f9adbc955559adfa57972a639c37fefc
3
+ metadata.gz: e5cc23052a16564dfac2f68f6668197ceda450b77fa83f87b0d33dc11138a863
4
+ data.tar.gz: 35f074caa0985696872a9bdb56f48f966897715b6ad2db5545b5c3d08d01117b
5
5
  SHA512:
6
- metadata.gz: 5fbf30e83a2f31e93831930eb4d4c09d4dc42a75f753f43da8b62082867e8810845f41da09dca4e8e840c2fdae569e1b95d6af565239c55f30b8474c88505cf7
7
- data.tar.gz: caf85a19d5a50f325a828fca0c6c3f55adb56345c9fe76afea48abf366706baac3268ec6d6584946516af9f94a3cfc04346f5a886f920d73c8c1a7df6599839a
6
+ metadata.gz: b5df602d53a93602c2733ace0a78ff16e0c1e2ea8958aa2585e56a7c119637f6d6e033761a710e66fb0c69e6c03701a264faf2e605c4eaf88333ccb2c860f9d7
7
+ data.tar.gz: 3b64bdcde548bb182088294b14d1e239e825b92dc3b43772839e2967e6da64900360c84dea1d0578251262511333a55a42c57d948d101af032235a417e9c3e3a
@@ -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", "> 5.0", "< 7"
21
+ spec.add_dependency "activerecord", "> 6.0", "< 6.1"
22
22
  spec.add_dependency "activesupport"
23
23
 
24
24
  spec.add_development_dependency "bundler"
@@ -33,7 +33,7 @@ module JitPreloadExtension
33
33
  records.each do |record|
34
34
  record.jit_preload_scoped_relations ||= {}
35
35
  association = record.association(base_association)
36
- record.jit_preload_scoped_relations[name] = preloader_association.records_by_owner[record]
36
+ record.jit_preload_scoped_relations[name] = preloader_association.records_by_owner[record] || []
37
37
  end
38
38
 
39
39
  jit_preload_scoped_relations[name]
@@ -1,3 +1,3 @@
1
1
  module JitPreloader
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
@@ -90,5 +90,18 @@ RSpec.describe "ActiveRecord::Base Extensions" do
90
90
  expect(contacts.last.association(:addresses)).to be_loaded
91
91
  end
92
92
  end
93
+
94
+ context "when no records exist for the association" do
95
+ let!(:record) { Parent.create }
96
+
97
+ it "returns an empty array" do
98
+ value = record.preload_scoped_relation(
99
+ name: "Parent Children",
100
+ base_association: :parents_child
101
+ )
102
+
103
+ expect(value).to eq([])
104
+ end
105
+ end
93
106
  end
94
107
  end
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: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle d'Oliveira
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-03 00:00:00.000000000 Z
11
+ date: 2021-04-13 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: '5.0'
19
+ version: '6.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7'
22
+ version: '6.1'
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: '5.0'
29
+ version: '6.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7'
32
+ version: '6.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: activesupport
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -178,7 +178,7 @@ homepage: ''
178
178
  licenses:
179
179
  - MIT
180
180
  metadata: {}
181
- post_install_message:
181
+ post_install_message:
182
182
  rdoc_options: []
183
183
  require_paths:
184
184
  - lib
@@ -193,8 +193,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  requirements: []
196
- rubygems_version: 3.0.3
197
- signing_key:
196
+ rubygems_version: 3.2.3
197
+ signing_key:
198
198
  specification_version: 4
199
199
  summary: Tool to understand N+1 queries and to remove them
200
200
  test_files: