n1_loader 0.1.0 → 0.1.1
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 +3 -1
- data/lib/n1_loader/active_record/associations_preloader.rb +3 -1
- data/lib/n1_loader/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1c77174344683dfa1f18c6ef34c4fee5a00442329258af0901cf2ffc213b6b0f
|
|
4
|
+
data.tar.gz: ca7e41b15dc34a07c7178345417c3096710099d1858308fa5f3135c1d617f45b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 49cb4c8f58678f8fbd8779d287039888af84eebaa728b881125041641e4840e5442f6ce878bb04647cb76f0cd85bb1921a5a0c6338f4685c90c9a9ad8caa650e
|
|
7
|
+
data.tar.gz: 4a5ec6cf4250e432697d51923239c9d214acf47617f692892541004d3fa62ce595d7451571f678f4e0dccc544a6e43e68eb34fa7003707c8ba93fd26efc11c2b
|
data/README.md
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
[![Gem Version][3]][4]
|
|
5
5
|
|
|
6
6
|
Are you tired of fixing [N+1 issues][7]? Does it feel unnatural to you to fix it case by case in places where you need the data?
|
|
7
|
-
We have a solution for you!
|
|
7
|
+
We have a solution for you!
|
|
8
|
+
|
|
9
|
+
[N1Loader][8] is designed to solve the issue for good!
|
|
8
10
|
|
|
9
11
|
It has many benefits:
|
|
10
12
|
- it loads data lazily (even when you initialized preloading)
|
|
@@ -17,7 +17,9 @@ module N1Loader
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def grouped_records(association, records, polymorphic_parent)
|
|
20
|
-
n1_load_records, records = records.partition
|
|
20
|
+
n1_load_records, records = records.partition do |record|
|
|
21
|
+
record.class.respond_to?(:n1_loader_defined?) && record.class.n1_loader_defined?(association)
|
|
22
|
+
end
|
|
21
23
|
|
|
22
24
|
hash = n1_load_records.group_by do |record|
|
|
23
25
|
N1LoaderReflection.new(association, record.class.n1_loader(association))
|
data/lib/n1_loader/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: n1_loader
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Evgeniy Demin
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-12-
|
|
11
|
+
date: 2021-12-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|