ar_lazy_preload 2.0.0 → 2.1.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/README.md +1 -0
- data/lib/ar_lazy_preload/contexts/base_context.rb +1 -1
- data/lib/ar_lazy_preload/version.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82d5aeed661b9ab42f1d15f78cb8db84cc8b426ddfe26ae1442f297800ec0707
|
4
|
+
data.tar.gz: 1c89c0b2f8025143186551e06629c40a37bf8c207b7605c71481b02c158f89f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acbedff3a73e2b26ee0a905c9b5059e9e27297abccd2a16c0a68c3bd67001a4d45721b83aaad21738b36d6c7bce8d41ea6756bd0f1bd54973f339ab2cc26ea68
|
7
|
+
data.tar.gz: 5285e4116f8ba49bc7aa2cbfc1962bfff112785ebd7dbed823ebadf606e9eef1f0772f7f30312344a00cbe8c76af37fc0378d422933073d8758bebe5ae6bcd85
|
data/README.md
CHANGED
@@ -74,6 +74,7 @@ posts = User.preload_associations_lazily.flat_map(&:posts)
|
|
74
74
|
|
75
75
|
2. When `#size` is called on association (e.g., `User.lazy_preload(:posts).map { |u| u.posts.size }`), lazy preloading won't happen, because `#size` method performs `SELECT COUNT()` database request instead of loading the association when association haven't been loaded yet ([here](https://github.com/DmitryTsepelev/ar_lazy_preload/pull/42) is the issue, and [here](https://blazarblogs.wordpress.com/2019/07/27/activerecord-size-vs-count-vs-length/) is the explanation article about `size`, `length` and `count`).
|
76
76
|
|
77
|
+
3. Lazy preloading for **ActiveStorage** variants is not working automatically because of the way how it is implemented ([here](https://github.com/DmitryTsepelev/ar_lazy_preload/pull/70) is the issue). You can preload them manually by calling `#with_all_variant_records`/`#with_attached_#{attachment_name}` on association. Example: `User.with_attached_avatar.first(10).map { |u| u.avatar.variant(:small).processed.url }`
|
77
78
|
|
78
79
|
## Installation
|
79
80
|
|
@@ -92,7 +92,7 @@ module ArLazyPreload
|
|
92
92
|
|
93
93
|
def preloadable_reflection?(klass, reflection)
|
94
94
|
scope = reflection.scope
|
95
|
-
preloadable_scope = scope&.arity&.zero?
|
95
|
+
preloadable_scope = scope&.arity&.zero? || ::ActiveRecord::VERSION::MAJOR >= 7
|
96
96
|
through_reflection =
|
97
97
|
reflection.options[:through] && klass.reflect_on_association(reflection.options[:through])
|
98
98
|
preloadable_through_reflection =
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar_lazy_preload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DmitryTsepelev
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '6.
|
19
|
+
version: '6.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '6.
|
26
|
+
version: '6.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 1.57.2
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 1.57.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: db-query-matchers
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,7 +212,7 @@ homepage: https://github.com/DmitryTsepelev/ar_lazy_preload
|
|
212
212
|
licenses:
|
213
213
|
- MIT
|
214
214
|
metadata: {}
|
215
|
-
post_install_message:
|
215
|
+
post_install_message:
|
216
216
|
rdoc_options: []
|
217
217
|
require_paths:
|
218
218
|
- lib
|
@@ -220,15 +220,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
220
220
|
requirements:
|
221
221
|
- - ">="
|
222
222
|
- !ruby/object:Gem::Version
|
223
|
-
version: '
|
223
|
+
version: '3.0'
|
224
224
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
225
225
|
requirements:
|
226
226
|
- - ">="
|
227
227
|
- !ruby/object:Gem::Version
|
228
228
|
version: '0'
|
229
229
|
requirements: []
|
230
|
-
rubygems_version: 3.
|
231
|
-
signing_key:
|
230
|
+
rubygems_version: 3.4.10
|
231
|
+
signing_key:
|
232
232
|
specification_version: 4
|
233
233
|
summary: lazy_preload implementation for ActiveRecord models
|
234
234
|
test_files: []
|