forest_admin_datasource_toolkit 1.0.0.pre.beta.64 → 1.0.0.pre.beta.65
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd5e11bf75b0839e35d3f44e6502e76785c5b4d376cb94d128d877d49030e365
|
4
|
+
data.tar.gz: ff66ca88263adb91efbb6a2f254893f4274a779ba062bc865ec06b9756790f84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1229b9e6453ecc3ad4ace3869c252a01a2fd19227c0b603369de3a3e6e834990a8357a0c20ca32d733baa7b79b2f9ceb3a1cdc47d03a5e5299b1d9cd43e213b7
|
7
|
+
data.tar.gz: cd6dab546b51a50ee21a7ae62d15cbeab11075625e9e1e7d146ff55a6592877557faf67705aca60884277255fb766d0cf06fadc0435219f6adbcb4eb5e6ef94f
|
@@ -14,6 +14,8 @@ module ForestAdminDatasourceToolkit
|
|
14
14
|
inverse = foreign_collection.schema[:fields].select do |_name, field|
|
15
15
|
if polymorphic_relations.include?(relation_field.type)
|
16
16
|
field.is_a?(PolymorphicManyToOneSchema) &&
|
17
|
+
field.foreign_key_type_field == relation_field.origin_type_field &&
|
18
|
+
field.foreign_key == relation_field.origin_key &&
|
17
19
|
field.foreign_collections.include?(collection.name)
|
18
20
|
else
|
19
21
|
field.is_a?(RelationSchema) &&
|
@@ -22,19 +22,26 @@ module ForestAdminDatasourceToolkit
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
else
|
25
|
-
prefix = field
|
25
|
+
prefix, suffix = field.split(':')
|
26
26
|
schema = collection.schema[:fields][prefix]
|
27
27
|
|
28
28
|
raise Exceptions::ValidationError, "Relation not found: '#{collection.name}.#{prefix}'" if schema.nil?
|
29
29
|
|
30
|
-
if schema.type
|
30
|
+
if schema.type == 'PolymorphicManyToOne' && suffix != '*'
|
31
|
+
raise Exceptions::ValidationError, "Unexpected nested field #{suffix} under generic relation: #{collection.name}.#{prefix}"
|
32
|
+
end
|
33
|
+
|
34
|
+
if schema.type != 'ManyToOne' && schema.type != 'OneToOne' && schema.type != 'PolymorphicManyToOne' &&
|
35
|
+
schema.type != 'PolymorphicOneToOne'
|
31
36
|
raise Exceptions::ValidationError,
|
32
|
-
"Unexpected field type: '#{collection.name}.#{prefix}' (found '#{schema.type}'
|
37
|
+
"Unexpected field type: '#{collection.name}.#{prefix}' (found '#{schema.type}')"
|
33
38
|
end
|
34
39
|
|
35
|
-
|
36
|
-
|
37
|
-
|
40
|
+
if schema.type != 'PolymorphicManyToOne'
|
41
|
+
suffix = field[dot_index + 1, field.length - dot_index - 1]
|
42
|
+
association = collection.datasource.get_collection(schema.foreign_collection)
|
43
|
+
validate(association, suffix, values)
|
44
|
+
end
|
38
45
|
end
|
39
46
|
end
|
40
47
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forest_admin_datasource_toolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.beta.
|
4
|
+
version: 1.0.0.pre.beta.65
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthieu
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-08-
|
12
|
+
date: 2024-08-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|