forest_admin_datasource_active_record 1.13.2 → 1.13.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: 8b46f4642898cc61672616b5b8e0fd227224f937a2804ec349a3d04dc182d961
4
- data.tar.gz: 729c4a3b405da4445f308bb67bb9837623b99b1e58732c217077cec591328b5b
3
+ metadata.gz: 7dcceae51ee5c4e32498c0fff0e2e72d1b50dabbe48481f341b6517a0d5509cf
4
+ data.tar.gz: 5382003e4fa3a25e7053f8075a48e9eca112dd430e32d7bd50949c3b50454746
5
5
  SHA512:
6
- metadata.gz: 71d8d9f2c3a8c8cf74035621cbf73ae6fda91ae4fb0cd9afc6abf63eb617ccaa4c447daf255547a5e7fe180e993590c31a6698eef12b56dbdc859b008be5b912
7
- data.tar.gz: 7334e0a5fd5c655e15c8ed99b79938c58836b15abc1fc6cf86696276ebd07a03079d7a780ecefc289331ca1a0736de802627b8de8eda23bc901cf490aec412a8
6
+ metadata.gz: 7737f65368f56c592c1f38e7196a3a9b1d32f325964beba45a4d16038589aa15e19dff5c5f4c9987691a838000527c8355c8b5009d5d52df906eca7d2253d29f
7
+ data.tar.gz: 183638680a962bb0a1ccbeac286dd8f40a99afa98240bc22f2b1d8d9f382f582e9504118483fc38ec22d2012dd6d04ecb235fbfa2bf45b0d4b1f2ec349b118df
@@ -132,8 +132,11 @@ module ForestAdminDatasourceActiveRecord
132
132
  foreign_key_targets: foreign_collections
133
133
  )
134
134
  )
135
- schema[:fields][association.foreign_key].is_read_only = true
136
- schema[:fields][association.foreign_type].is_read_only = true
135
+
136
+ warn_missing_polymorphic_columns(association)
137
+
138
+ schema[:fields][association.foreign_key]&.is_read_only = true
139
+ schema[:fields][association.foreign_type]&.is_read_only = true
137
140
  else
138
141
  add_field(
139
142
  association.name.to_s,
@@ -196,5 +199,21 @@ module ForestAdminDatasourceActiveRecord
196
199
  end
197
200
  end
198
201
  end
202
+
203
+ def warn_missing_polymorphic_columns(association)
204
+ missing_columns = []
205
+ missing_columns << association.foreign_key unless schema[:fields][association.foreign_key]
206
+ missing_columns << association.foreign_type unless schema[:fields][association.foreign_type]
207
+
208
+ return unless missing_columns.any?
209
+
210
+ logger = ActiveSupport::Logger.new($stdout)
211
+ columns_list = missing_columns.join(', ')
212
+ logger.warn(
213
+ "[ForestAdmin] ⚠️ Missing columns for polymorphic association '#{association.name}' " \
214
+ "in model '#{@model.name}': #{columns_list}. " \
215
+ 'This may indicate pending migrations. Run `rails db:migrate:status` to check.'
216
+ )
217
+ end
199
218
  end
200
219
  end
@@ -1,3 +1,3 @@
1
1
  module ForestAdminDatasourceActiveRecord
2
- VERSION = "1.13.2"
2
+ VERSION = "1.13.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.13.2
4
+ version: 1.13.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: 2025-11-04 00:00:00.000000000 Z
12
+ date: 2025-11-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord