forest_admin_datasource_customizer 1.0.0.pre.beta.97 → 1.0.0.pre.beta.98

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: aa8f64dda68a3b4bef6dff85187c683caf574e314b13d73c9793a101ed01d677
4
- data.tar.gz: f428d4daa0b9ee47fb1b276a1a8ac8ba72d01e76af93aa06b5947c8f3284ae97
3
+ metadata.gz: edbcdbac95176a4c99cddfb4d4e1c32182d80c50e4d1b3e39b36c12bac3fe8ed
4
+ data.tar.gz: 8438091e0f5481b7c6ef0d7d9762e10c1c983ad4779cd8b1e3cc60731175b9d3
5
5
  SHA512:
6
- metadata.gz: 122284df7ca6cc77363e3334d65ba1507704a2c8e1b948b338554795ca83731102b46c6c9a909566e804ab0adbbc368a0445d29fba1ad89f5b4f1c30eed18487
7
- data.tar.gz: 296c4a86d780c13ae98e931a3ddc794a062f3a4494e9772c83534ca6e07dce8229543c0d734fb63f4357cf30cebf5e48f727d772fd0fd21262e9ceb1c41c2426
6
+ metadata.gz: ed029d1f4515d79d7e450b09832cd60f1c34eeb48a7ce5fba5aca7b4c2f48249ee0b432ed383b0186cb767073a11c89761254c08cb20a06c1f42dbcf897aa247
7
+ data.tar.gz: e9acf968fae4ee907b26c0469f6864ab82f79e563f5f799efa088db1a64a6c2cda2779e25835ce9cf85c9e5af3140dd57fe9d421fa97d59a9587b3003ce7b053
@@ -152,14 +152,13 @@ module ForestAdminDatasourceCustomizer
152
152
  # Convert field path from child collection to this collection
153
153
  def path_from_child_collection(path)
154
154
  if path.include?(':')
155
- paths = path.split(':')
156
- child_field = paths[0]
155
+ child_field = path[0..path.index(':') - 1]
157
156
  relation_name = from_child_collection[child_field] || child_field
158
157
  relation_schema = schema[:fields][relation_name]
159
158
  if relation_schema.type != 'PolymorphicManyToOne'
160
159
  relation = datasource.get_collection(relation_schema.foreign_collection)
161
160
 
162
- return "#{relation_name}:#{relation.path_from_child_collection(paths[1])}"
161
+ return "#{relation_name}:#{relation.path_from_child_collection(path[path.index(":") + 1..])}"
163
162
  end
164
163
  end
165
164
 
@@ -169,18 +168,17 @@ module ForestAdminDatasourceCustomizer
169
168
  # Convert field path from this collection to child collection
170
169
  def path_to_child_collection(path)
171
170
  if path.include?(':')
172
- paths = path.split(':')
173
- relation_name = paths[0]
171
+ relation_name = path[0..path.index(':') - 1]
174
172
  relation_schema = schema[:fields][relation_name]
175
173
  if relation_schema.type == 'PolymorphicManyToOne'
176
174
  relation_name = to_child_collection[relation_name] || relation_name
177
175
 
178
- return "#{relation_name}:#{paths[1]}"
176
+ return "#{relation_name}:#{path[path.index(":") + 1..]}"
179
177
  else
180
178
  relation = datasource.get_collection(relation_schema.foreign_collection)
181
179
  child_field = to_child_collection[relation_name] || relation_name
182
180
 
183
- return "#{child_field}:#{relation.path_to_child_collection(paths[1])}"
181
+ return "#{child_field}:#{relation.path_to_child_collection(path[path.index(":") + 1..])}"
184
182
  end
185
183
  end
186
184
 
@@ -1,3 +1,3 @@
1
1
  module ForestAdminDatasourceCustomizer
2
- VERSION = "1.0.0-beta.97"
2
+ VERSION = "1.0.0-beta.98"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_datasource_customizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.beta.97
4
+ version: 1.0.0.pre.beta.98
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-02-24 00:00:00.000000000 Z
12
+ date: 2025-02-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport