forest_liana 9.17.2 → 9.17.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 +4 -4
- data/app/services/forest_liana/resources_getter.rb +39 -14
- data/lib/forest_liana/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6827e64710a291b05c5a7363b968d70dc1ce182f8a3f7f05ef25496f168ab261
|
|
4
|
+
data.tar.gz: 1afdf02d2d262fc58cfddc0bc845816f5b4a636069c15817d5d4963607d13734
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 124e2c6349b38bc9dea8ec3821cd0918f14f08cbf3f89d141424407734a32dadead2d0b0d5e379498b725fc06a266ab50c4969389072591553fe9da94f53b4e3
|
|
7
|
+
data.tar.gz: a6e6d5c1f27d03abb33a0faa5f5f7fb77d879585cb3f299c9623e056e56921af785f650f2dbc69d5cc63bf1188336452dc93bb247ea3a59cfd325fd8ea577691
|
|
@@ -343,23 +343,44 @@ module ForestLiana
|
|
|
343
343
|
association = get_one_association(path)
|
|
344
344
|
if association
|
|
345
345
|
through_chain = []
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
346
|
+
current_association = association
|
|
347
|
+
while current_association.options[:through]
|
|
348
|
+
through_chain << current_association.options[:through]
|
|
349
|
+
current_association = get_one_association(current_association.options[:through])
|
|
349
350
|
end
|
|
350
351
|
|
|
351
352
|
# Skip ActiveStorage associations - already processed above
|
|
352
353
|
next if is_active_storage_association?(association)
|
|
353
354
|
|
|
354
|
-
# For :through associations,
|
|
355
|
-
# Don't try to select columns from the main table for the final :through target
|
|
355
|
+
# For :through associations, recursively add all intermediate foreign keys
|
|
356
356
|
if through_chain.any?
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
357
|
+
current_resource = @resource
|
|
358
|
+
through_chain.reverse.each do |through_name|
|
|
359
|
+
through_assoc = current_resource.reflect_on_association(through_name)
|
|
360
|
+
|
|
361
|
+
if through_assoc
|
|
362
|
+
if through_assoc.options[:through]
|
|
363
|
+
direct_through_name = through_assoc.options[:through]
|
|
364
|
+
direct_assoc = current_resource.reflect_on_association(direct_through_name)
|
|
365
|
+
|
|
366
|
+
if direct_assoc && (direct_assoc.macro == :belongs_to || direct_assoc.macro == :has_one)
|
|
367
|
+
fks = Array(direct_assoc.foreign_key)
|
|
368
|
+
fks.each do |fk|
|
|
369
|
+
select << "#{current_resource.table_name}.#{fk}"
|
|
370
|
+
end
|
|
371
|
+
end
|
|
372
|
+
else
|
|
373
|
+
# Direct association (not nested through)
|
|
374
|
+
if through_assoc.macro == :belongs_to || through_assoc.macro == :has_one
|
|
375
|
+
fks = Array(through_assoc.foreign_key)
|
|
376
|
+
fks.each do |fk|
|
|
377
|
+
select << "#{current_resource.table_name}.#{fk}"
|
|
378
|
+
end
|
|
379
|
+
end
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
# Move to the next level in the chain
|
|
383
|
+
current_resource = through_assoc.klass if through_assoc.klass
|
|
363
384
|
end
|
|
364
385
|
end
|
|
365
386
|
else
|
|
@@ -369,8 +390,8 @@ module ForestLiana
|
|
|
369
390
|
end
|
|
370
391
|
|
|
371
392
|
if association.macro == :belongs_to || association.macro == :has_one
|
|
372
|
-
|
|
373
|
-
|
|
393
|
+
fks = Array(association.foreign_key)
|
|
394
|
+
fks.each do |fk|
|
|
374
395
|
select << "#{@resource.table_name}.#{fk}"
|
|
375
396
|
end
|
|
376
397
|
end
|
|
@@ -394,7 +415,11 @@ module ForestLiana
|
|
|
394
415
|
end
|
|
395
416
|
end
|
|
396
417
|
else
|
|
397
|
-
|
|
418
|
+
# Only add as column if it's not an association
|
|
419
|
+
# Associations are handled by the through chain logic above
|
|
420
|
+
unless association
|
|
421
|
+
select << "#{@resource.table_name}.#{path}"
|
|
422
|
+
end
|
|
398
423
|
end
|
|
399
424
|
end
|
|
400
425
|
|
data/lib/forest_liana/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forest_liana
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 9.17.
|
|
4
|
+
version: 9.17.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sandro Munda
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-01-
|
|
11
|
+
date: 2026-01-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|