forest_admin_datasource_active_record 1.0.0.pre.beta.62 → 1.0.0.pre.beta.64

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 768aba915cd8fc48929a8bdc08fdf81dd735aa9b6d8d7f2a7f2ecb4c99c4e854
4
- data.tar.gz: 32a0e8e3b7468dd6ec2244ea1b59da6383af8f36f48b4c5d7025094550612eca
3
+ metadata.gz: 045e8d60b23ab5557ab023f14464326e8350d433ea7aa41b8e5c67c5708dae42
4
+ data.tar.gz: 9c551753c265dfa3877c9ec45ed8e4177c89461c6dc958ca9fa0b7ceb14e4354
5
5
  SHA512:
6
- metadata.gz: 7cea2e22bccfce7e48423cce3656b9457cea8882721bb6f39dc6ca44b7edc8fefcb9f0b8bde0226f33fa3ae5dcaae0b5d23113eeb92e6ef9e71793d70c427fb1
7
- data.tar.gz: 7a015c989b6183d4a97c8d95f1f614b7a6fa58d64e2a498072e246218e6398040e22ec7098bc260ee8cc045119adf8155a64063cad007ad5f0c8ee93869979e6
6
+ metadata.gz: 2a3db924169e5a4682516416239c99b8c6dcda963fbb6aadd14395153b9fc0d5dc94c69f8526bfa5b0bc90fec13f35874f355354814b7e462b866f777ebc79a9
7
+ data.tar.gz: ac8b1c91e3c2a9e1463d9d5ebae3965ecc1f1370df65213a76b4af6779156cda0bb169bbe0f5e6f9c50dda85cc9708879088de6f6b544fe425c10bfcb697624f
@@ -3,10 +3,11 @@ module ForestAdminDatasourceActiveRecord
3
3
  module Relation
4
4
  def associations(model, support_polymorphic_relations: false)
5
5
  model.reflect_on_all_associations.select do |association|
6
+ is_valid_association = !get_class(association).nil? && !active_type?(get_class(association))
6
7
  if support_polymorphic_relations
7
- polymorphic?(association) ? true : !active_type?(association.klass)
8
+ polymorphic?(association) ? true : is_valid_association
8
9
  else
9
- !polymorphic?(association) && !active_type?(association.klass)
10
+ !polymorphic?(association) && is_valid_association
10
11
  end
11
12
  end
12
13
  end
@@ -16,6 +17,12 @@ module ForestAdminDatasourceActiveRecord
16
17
  association.inverse_of&.polymorphic?
17
18
  end
18
19
 
20
+ def get_class(association)
21
+ association.klass
22
+ rescue StandardError
23
+ nil
24
+ end
25
+
19
26
  # NOTICE: Ignores ActiveType::Object association during introspection and interactions.
20
27
  # See the gem documentation: https://github.com/makandra/active_type
21
28
  def active_type?(model)
@@ -3,9 +3,11 @@ module ForestAdminDatasourceActiveRecord
3
3
  class Query
4
4
  include ForestAdminDatasourceToolkit::Components::Query::ConditionTree
5
5
 
6
+ attr_reader :query
7
+
6
8
  def initialize(collection, projection, filter)
7
9
  @collection = collection
8
- @query = @collection.model
10
+ @query = @collection.model.unscoped
9
11
  @projection = projection
10
12
  @filter = filter
11
13
  @arel_table = @collection.model.arel_table
@@ -1,3 +1,3 @@
1
1
  module ForestAdminDatasourceActiveRecord
2
- VERSION = "1.0.0-beta.62"
2
+ VERSION = "1.0.0-beta.64"
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.62
4
+ version: 1.0.0.pre.beta.64
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: 2024-08-19 00:00:00.000000000 Z
12
+ date: 2024-08-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord