globalid 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/global_id/locator.rb +6 -2
- 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: 18495b4f7910329fd0a65dcfa294742d0cdbb129a4c7f6971c4f9c62e9ea890d
|
4
|
+
data.tar.gz: 5b6a25aabd0d04d9a4a2d4bb4d5152d68a67758fad96deabc011a4a169f2a055
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb525d60050154b885197a89aaf2b1f2f577d0574b83160a3c0cbc2899d67e8995cf23c2de852c30baaa1ef8cc594cad39187e3808b350195c95ead32359957c
|
7
|
+
data.tar.gz: 5dda5c09cffcc6e60da06931f3be5ba144db99f6ed0b9d7dc085633e0bac642f1c9d9ac7ba686dd59a6b9be64bb275ee8e78b39fae6e372b69c8131709db6f0f
|
data/lib/global_id/locator.rb
CHANGED
@@ -190,14 +190,18 @@ class GlobalID
|
|
190
190
|
model_class = model_class.includes(options[:includes]) if options[:includes]
|
191
191
|
|
192
192
|
if options[:ignore_missing]
|
193
|
-
model_class.where(model_class
|
193
|
+
model_class.where(primary_key(model_class) => ids)
|
194
194
|
else
|
195
195
|
model_class.find(ids)
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
199
|
def model_id_is_valid?(gid)
|
200
|
-
Array(gid.model_id).size == Array(gid.model_class
|
200
|
+
Array(gid.model_id).size == Array(primary_key(gid.model_class)).size
|
201
|
+
end
|
202
|
+
|
203
|
+
def primary_key(model_class)
|
204
|
+
model_class.respond_to?(:primary_key) ? model_class.primary_key : :id
|
201
205
|
end
|
202
206
|
end
|
203
207
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: globalid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|