active_record_custom_preloader 0.4.0 → 0.4.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb12633dd33dca10db8ef101811d6b0350e901c1
|
4
|
+
data.tar.gz: 52588c79fe6e7e7f6c5912279a65105aa90d5176
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e874ed99f795a7c9be7857a94367f1ae1c8dc3bf6dbedf23479312f6b5cf0e546b99096649cef2e6e05055bdf90d590681ae77a64e7e0acb2ff3d937cb4205a3
|
7
|
+
data.tar.gz: d864d39edffb975976425713865d97b4c30323ec46dde3ef21526352d4bf5678773ee091d79a52e6825822ff6bd2baa718d0bb4e90aa9a33e7147b51b618798a
|
@@ -45,7 +45,8 @@ module ActiveRecordCustomPreloader
|
|
45
45
|
end
|
46
46
|
|
47
47
|
# association table is queried by return value of this method.
|
48
|
-
# returns array of keys for parent record to match association record
|
48
|
+
# returns array of keys for parent record to match association record.
|
49
|
+
# if you want to skip association for particular record - return nil.
|
49
50
|
def record_foreign_keys(parent_record)
|
50
51
|
association_foreign_keys(parent_record)
|
51
52
|
end
|
@@ -71,7 +72,7 @@ module ActiveRecordCustomPreloader
|
|
71
72
|
end
|
72
73
|
|
73
74
|
def fetch_association(parent_records)
|
74
|
-
keys = parent_records.map(&method(:record_foreign_keys))
|
75
|
+
keys = parent_records.map(&method(:record_foreign_keys)).compact
|
75
76
|
condition_part = association_foreign_keys_names.map { |name| "#{name} = ?" }.join(' AND ')
|
76
77
|
conditions = []
|
77
78
|
keys.size.times { conditions.push(condition_part) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_custom_preloader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Talakevich
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '5.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: sqlite3
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description: Custom preloader for ActiveRecord.
|
84
98
|
email:
|
85
99
|
- senid231@gmail.com
|