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: 9b180f96966e5abe1d3b7d9c622db7b8b7fbcc58fb998764ffd17d9f80957a3e
4
- data.tar.gz: d2d7e5f781ba2ce09fc6a3313c1e31c536b4b0ef4f9312b8a1dd0c58182bc441
3
+ metadata.gz: c7a9bcb67010564ea508f8ebcbc46c482840547b7ae3118dda4b804c8c5edaaa
4
+ data.tar.gz: 1727f5efd8ca8378cad534b49c5f95990105b8851d399db05a2dffe56201def7
5
5
  SHA512:
6
- metadata.gz: 5b94c1d3762259a3e06fb379e3de93cfb6865ca26a35e86b55eac33a5b65875d05b68b2b3eef9b3c493cc6f9d8dfacbf299ed7b4051236dc55af70344252fc3f
7
- data.tar.gz: 9039d0e4b573edfb34a27888611263a8d205d2c1c88a0889cea79fc5f9e188d866632a8c2b7629a3fe0f9fdcc4070dc8fd166f0a9dc7af199ef5d484e29d2fea
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 = {}
@@ -6,7 +6,7 @@ module ForestAdminAgent
6
6
  module Schema
7
7
  class SchemaEmitter
8
8
  LIANA_NAME = "agent-ruby"
9
- LIANA_VERSION = "1.35.3"
9
+ LIANA_VERSION = "1.35.4"
10
10
 
11
11
  def self.generate(datasource)
12
12
  datasource.collections
@@ -1,3 +1,3 @@
1
1
  module ForestAdminAgent
2
- VERSION = "1.35.3"
2
+ VERSION = "1.35.4"
3
3
  end
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.3
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-15 00:00:00.000000000 Z
12
+ date: 2026-07-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport