forest_admin_datasource_mongoid 1.28.2 → 1.29.0

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: 9974c15a82e37ea3ecb70b5024421cba3648797a852d37b3823dbbf9c5e60780
4
- data.tar.gz: ca08559e9acd3a1c3e609eea98a50e6d0ea8ce8a61c53a60389602798c873e2f
3
+ metadata.gz: 72c093382f024ea130a5a492b7278e8d6febebb412a606c77665c85ffebda5fa
4
+ data.tar.gz: 4b31f9b5be224ea0ca4cf11525801898e634e0ac709793ad4e41450cd1d76779
5
5
  SHA512:
6
- metadata.gz: e03dc957c52953eeedbecfdf68d7ba9c84a4141fbc835e0eda4ce4fce05be23d7ec99738b7f9197df3a098d29fcd03a0e57e5a6a987161d28eeaf5b74aa68e84
7
- data.tar.gz: cd1b94d929419758a06b0f3704077939ad79ad64db2e7ab91e3c32152097b20ff07cdd4fa08947535c52b337fecad6a7547e04749d448f261d77c1044d1e3bb5
6
+ metadata.gz: 6773e7c8ba83752ec11e55c19c96cf9bbab98b8d626a99621e7a9dde2572662d7d4c583258996494ec6de6f616cbc909fab49fb4895e0b136cb5d702bf7e3f0e
7
+ data.tar.gz: a963989610025b47c9a4e09a8c25d71f9449f2dc4615ee614a238fec819b1b7bbd4b8ba2b451d935dcbf8c771d340d28fc064e2bb02d4e3d4a44e900cc6e5b63
@@ -13,7 +13,7 @@ module ForestAdminDatasourceMongoid
13
13
  attr_reader :model, :stack
14
14
 
15
15
  def initialize(datasource, model, stack)
16
- prefix = stack[stack.length - 1][:prefix]
16
+ prefix = stack[-1][:prefix]
17
17
 
18
18
  @model = model
19
19
  @stack = stack
@@ -2,6 +2,7 @@ module ForestAdminDatasourceMongoid
2
2
  module Parser
3
3
  module Validation
4
4
  include ForestAdminDatasourceToolkit::Components::Query::ConditionTree
5
+
5
6
  def get_validations(model, column)
6
7
  return [] if column.is_a?(Hash)
7
8
  return [] if before_validation_callback?(model)
@@ -75,8 +75,8 @@ module ForestAdminDatasourceMongoid
75
75
  def compute_groups_projection(groups)
76
76
  return { '$literal' => {} } if groups.nil? || groups.empty?
77
77
 
78
- groups.each_with_object({}) do |group, memo|
79
- memo[group[:field]] = "$_id.#{group[:field]}"
78
+ groups.to_h do |group|
79
+ [group[:field], "$_id.#{group[:field]}"]
80
80
  end
81
81
  end
82
82
  end
@@ -38,7 +38,7 @@ module ForestAdminDatasourceMongoid
38
38
 
39
39
  return our_schema unless stack.length > 1
40
40
 
41
- parent_prefix = stack[stack.length - 2][:prefix]
41
+ parent_prefix = stack[-2][:prefix]
42
42
 
43
43
  our_schema['_id'] = build_virtual_primary_key
44
44
  parent_id = child_schema.fields['parent']['_id']
@@ -4,6 +4,7 @@ module ForestAdminDatasourceMongoid
4
4
  class MongoidSchema
5
5
  include ForestAdminDatasourceToolkit::Exceptions
6
6
  include Utils::Helpers
7
+
7
8
  attr_reader :is_array, :is_leaf, :fields, :models
8
9
 
9
10
  def initialize(model, fields, is_array, is_leaf)
@@ -23,14 +23,14 @@ module ForestAdminDatasourceMongoid
23
23
  # Create inverse of 'parent' relationship so that the relation name matches the actual name
24
24
  # of the data which is stored in the database.
25
25
  stack = collection.stack
26
- prefix = stack[stack.length - 1][:prefix]
26
+ prefix = stack[-1][:prefix]
27
27
  is_array = MongoidSchema.from_model(collection.model).apply_stack(stack).is_array
28
28
 
29
29
  type = is_array ? OneToManySchema : OneToOneSchema
30
30
  inverse_name = escape(prefix)
31
31
 
32
32
  if stack.length > 2
33
- previous_length = stack[stack.length - 2][:prefix].length + 1
33
+ previous_length = stack[-2][:prefix].length + 1
34
34
  inverse_name = prefix[previous_length..]
35
35
  end
36
36
  else
@@ -1,3 +1,3 @@
1
1
  module ForestAdminDatasourceMongoid
2
- VERSION = "1.28.2"
2
+ VERSION = "1.29.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_datasource_mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.28.2
4
+ version: 1.29.0
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-05-06 00:00:00.000000000 Z
12
+ date: 2026-05-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongoid