forest_admin_datasource_active_record 1.26.2 → 1.26.3

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: 3f8c8cef73a887ccde770ea4bcd99e300c1ba8f73a74231de2e8af5ead22f27d
4
- data.tar.gz: 382f8d214c2852bff04614f4e8f3ba4e5097ff64db93476a5f5e5cf02f4b667c
3
+ metadata.gz: 011c739dcf050579d73b0bc76affd1796e77d6210e36f71d50917d0db2df2020
4
+ data.tar.gz: f6f169eb4345b33b92dd30db70a97825dad314de56e25111b9dda331d063640a
5
5
  SHA512:
6
- metadata.gz: 86710fd9018855c34e32d341545494e57e1512d28b91e2ba4957544b1de1711b7be8729d399c7990a00649071a6089c080eea0e6580d2d4de7d6109c048025d3
7
- data.tar.gz: 925732e0e6dcf728548831a9930a8d9419d37e38f941bd326d7da042c09e44b6bf32fd3380fd4df5ab62da396692f37f47b63cd80352dd8488e89109ffaedb7a
6
+ metadata.gz: 11c06016083830a57c0a7437bc4424e3b62812c31c60ac3417519fa03c45d1029120be0536f2744c12342c3bdfc586a55a0a4b604c4fcbc730d5b5b66247253b
7
+ data.tar.gz: f568153571081e4ef06e63047518907807f5fba7305e1b07e66323de880ab9ece37ebc76262c9c022925005069fbffe40974d0ea771397e77965d4c0b3f233f6
@@ -92,6 +92,8 @@ module ForestAdminDatasourceActiveRecord
92
92
  if association.through_reflection?
93
93
  through_reflection = association.through_reflection
94
94
  is_polymorphic = through_reflection.options[:as].present?
95
+ source_polymorphic = association.source_reflection&.polymorphic? &&
96
+ association.options[:source_type].present?
95
97
 
96
98
  add_field(
97
99
  association.name.to_s,
@@ -103,7 +105,9 @@ module ForestAdminDatasourceActiveRecord
103
105
  foreign_key_target: association.association_primary_key,
104
106
  through_collection: format_model_name(through_reflection.klass.name),
105
107
  origin_type_field: is_polymorphic ? through_reflection.type : nil,
106
- origin_type_value: is_polymorphic ? @model.name : nil
108
+ origin_type_value: is_polymorphic ? @model.name : nil,
109
+ foreign_type_field: source_polymorphic ? association.source_reflection.foreign_type : nil,
110
+ foreign_type_value: source_polymorphic ? association.options[:source_type] : nil
107
111
  )
108
112
  )
109
113
  elsif association.inverse_of&.polymorphic?
@@ -162,6 +166,8 @@ module ForestAdminDatasourceActiveRecord
162
166
  if association.through_reflection?
163
167
  through_reflection = association.through_reflection
164
168
  is_polymorphic = through_reflection.options[:as].present?
169
+ source_polymorphic = association.source_reflection&.polymorphic? &&
170
+ association.options[:source_type].present?
165
171
 
166
172
  add_field(
167
173
  association.name.to_s,
@@ -173,7 +179,9 @@ module ForestAdminDatasourceActiveRecord
173
179
  foreign_key_target: association.association_primary_key,
174
180
  through_collection: format_model_name(through_reflection.klass.name),
175
181
  origin_type_field: is_polymorphic ? through_reflection.type : nil,
176
- origin_type_value: is_polymorphic ? @model.name : nil
182
+ origin_type_value: is_polymorphic ? @model.name : nil,
183
+ foreign_type_field: source_polymorphic ? association.source_reflection.foreign_type : nil,
184
+ foreign_type_value: source_polymorphic ? association.options[:source_type] : nil
177
185
  )
178
186
  )
179
187
  elsif association.inverse_of&.polymorphic?
@@ -1,3 +1,3 @@
1
1
  module ForestAdminDatasourceActiveRecord
2
- VERSION = "1.26.2"
2
+ VERSION = "1.26.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_datasource_active_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.26.2
4
+ version: 1.26.3
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-03-23 00:00:00.000000000 Z
12
+ date: 2026-03-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord