forest_admin_agent 1.35.3 → 1.35.4
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
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c7a9bcb67010564ea508f8ebcbc46c482840547b7ae3118dda4b804c8c5edaaa
|
|
4
|
+
data.tar.gz: 1727f5efd8ca8378cad534b49c5f95990105b8851d399db05a2dffe56201def7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 987afa5dd62efa00205ee78092a3446544a58d032212de39c407ea45e38f8c28b34d0eaef555d5d987f69d7c0e21d0433f360e5a8904b21660553420edda6777
|
|
7
|
+
data.tar.gz: 15217148781c799a383e714112e282255d499dc37dbc72a731b712ed88ae22011023dd9db0df8e5c199c3a3e63dc36c4fa37a7b9b12d1e626b164172b9e7c581
|
|
@@ -93,6 +93,27 @@ module ForestAdminAgent
|
|
|
93
93
|
@to_one_associations[name] = format_field(name, options)
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
+
# A PolymorphicManyToOne can't be SQL-joined, so list projections return a phantom object with no
|
|
97
|
+
# primary key. Rebuild the id from the foreign key on the owner record.
|
|
98
|
+
def has_one_relationship(attribute_name, attr_data)
|
|
99
|
+
object = super
|
|
100
|
+
return object if object.nil? # relation not projected (e.g. update/store responses)
|
|
101
|
+
|
|
102
|
+
field = ForestAdminAgent::Facades::Container.datasource
|
|
103
|
+
.get_collection(@options[:class_name].gsub('::', '__'))
|
|
104
|
+
.schema[:fields][attribute_name.to_s]
|
|
105
|
+
return object unless field&.type == 'PolymorphicManyToOne'
|
|
106
|
+
|
|
107
|
+
foreign_key = @object[field.foreign_key]
|
|
108
|
+
foreign_type = @object[field.foreign_key_type_field]
|
|
109
|
+
return nil if foreign_key.nil? || foreign_type.nil?
|
|
110
|
+
|
|
111
|
+
# foreign_key_targets is keyed by formatted collection names (Admin::User => Admin__User),
|
|
112
|
+
# but foreign_type is the raw AR type column value, so format it before the lookup.
|
|
113
|
+
primary_key = (field.foreign_key_targets || {})[foreign_type.gsub('::', '__')] || 'id'
|
|
114
|
+
(object.is_a?(Hash) ? object : {}).merge(primary_key => foreign_key)
|
|
115
|
+
end
|
|
116
|
+
|
|
96
117
|
def has_one_relationships
|
|
97
118
|
return {} if @to_one_associations.nil?
|
|
98
119
|
data = {}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forest_admin_agent
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.35.
|
|
4
|
+
version: 1.35.4
|
|
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: 2026-07-
|
|
12
|
+
date: 2026-07-21 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|