forest_admin_datasource_active_record 1.0.0.pre.beta.89 → 1.0.0.pre.beta.90

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: 070f3028960d413de46377bc668f8d8cb92a7bfadf79509ea9746639e07f3082
4
- data.tar.gz: f868d52777f1d92a43245891a11fd0ac01cfd374e1f9585c4b73d002259c9dd0
3
+ metadata.gz: 9303fa0932104c810394b7f71dc7e7b2fb1bac40b75e1b2c449772b2174943be
4
+ data.tar.gz: 6aaabfe5a9c65857ebc201e620d1281fe216ce9af79aa251ef53e4082bec032b
5
5
  SHA512:
6
- metadata.gz: eb3b06693df4ad3c9f2947b9cf09ef5cd063c07fd4ebb1a008f91bf3d2cb914ba0d6bd573c8868c235185a0b33ffd8ab05f71fe7086847f8bfc83b0d79fce540
7
- data.tar.gz: 7990430b07bbc288807ef5ef891393010354d7322e05d7d2bf7c9113e7b4a857d1c675e3f4156004b90c3050a341c0f5ce24157eccc8ca3a9766be0bafe4e044
6
+ metadata.gz: c2436c3c035fafd645aeaa73cee0ee8a75c770ddd8be3e40e1c4f2ae7fd44ed4b88ec50f01802eff5ba0a188a0b3409c8958496ab28e3f494a67a0bc57a9951b
7
+ data.tar.gz: 6c684484d5ca0323ccb1fc1bdce1288ec8c6f52e55a8e76969486d07bb90928c31cbb0fec2c77df61ddc72f97b164302b98c3a9ecac7e9f56ef12c3a99e462c7
@@ -27,8 +27,18 @@ module ForestAdminDatasourceActiveRecord
27
27
  return 'Enum'
28
28
  end
29
29
 
30
+ if TYPES.key?(column.type)
31
+ type = TYPES[column.type]
32
+ else
33
+ type = TYPES[:string]
34
+ ForestAdminAgent::Facades::Container.logger.log(
35
+ 'Info',
36
+ "unknown type '#{column.type}' for field named '#{column.name}', '#{TYPES[:string]}' type use by default"
37
+ )
38
+ end
39
+
30
40
  is_array = column.respond_to?(:array) && column.array == true
31
- is_array ? "[#{TYPES[column.type]}]" : TYPES[column.type]
41
+ is_array ? "[#{type}]" : type
32
42
  end
33
43
 
34
44
  def get_enum_values(model, column)
@@ -51,7 +51,7 @@ module ForestAdminDatasourceActiveRecord
51
51
  end
52
52
 
53
53
  def parse_length_validator(validator, parsed_validations)
54
- return unless get_column_type(column) == 'String'
54
+ return unless get_column_type(@model, column) == 'String'
55
55
 
56
56
  validator.options.each do |option, value|
57
57
  case option
@@ -97,7 +97,7 @@ module ForestAdminDatasourceActiveRecord
97
97
  @select += @projection.columns.map { |field| "#{@collection.model.table_name}.#{field}" }
98
98
  @projection.relations.each_key do |relation|
99
99
  relation_schema = @collection.schema[:fields][relation]
100
- @select << if relation_schema.type == 'OneToOne' || relation_schema.type == 'PolymorphicOneToOne'
100
+ @select << if ['OneToOne', 'PolymorphicOneToOne'].include?(relation_schema.type)
101
101
  "#{@collection.model.table_name}.#{relation_schema.origin_key_target}"
102
102
  else
103
103
  "#{@collection.model.table_name}.#{relation_schema.foreign_key}"
@@ -1,3 +1,3 @@
1
1
  module ForestAdminDatasourceActiveRecord
2
- VERSION = "1.0.0-beta.89"
2
+ VERSION = "1.0.0-beta.90"
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.0.0.pre.beta.89
4
+ version: 1.0.0.pre.beta.90
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-01-08 00:00:00.000000000 Z
12
+ date: 2025-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord