n1_loader 0.1.0 → 0.1.1

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: 8e2a77c7fdcb24c0ad611468803c952e120c43b2c54be109828380d01723dd3f
4
- data.tar.gz: 37dfae873e6cba9e5539b4609d324ff3fc5489d5be305eec1bbac5389089379c
3
+ metadata.gz: 1c77174344683dfa1f18c6ef34c4fee5a00442329258af0901cf2ffc213b6b0f
4
+ data.tar.gz: ca7e41b15dc34a07c7178345417c3096710099d1858308fa5f3135c1d617f45b
5
5
  SHA512:
6
- metadata.gz: 8fe48829416810c0fac586dbe4b5002e4de2906d5ed1d99813d094c77db29d1a941cf742d078463632a0802fecfea55cc091e469b7510d2d566a4f2acdb1413f
7
- data.tar.gz: 71038ccc2403d0baae719ebbd9a00ed7351e1370c255bf5bd3a5d826d4d6824323c53bd317d7193bc92a175b1786abb2b27a64b45e34d97c6427baaee3c58844
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! [N1Loader][8] is designed to solve the issue for good!
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 { |record| record.class.n1_loader_defined?(association) }
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))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module N1Loader
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
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.0
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-18 00:00:00.000000000 Z
11
+ date: 2021-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord