Skip to content

Commit bbece2a

Browse files
committed
fix: export csv
1 parent 15ab41b commit bbece2a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

app/controllers/forest_liana/application_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,9 @@ def render_csv getter, model
229229
included = json['included']
230230

231231
values = field_names_requested.map do |field_name|
232-
if record_attributes[field_name]
232+
if field_name == 'id'
233+
json['data']['id']
234+
elsif record_attributes[field_name]
233235
record_attributes[field_name]
234236
elsif record_relationships[field_name] &&
235237
record_relationships[field_name]['data']

app/services/forest_liana/resources_getter.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,8 @@ def compute_select_fields
386386
next if association && is_active_storage_association?(association)
387387

388388
fields.each do |association_path|
389+
next if association_path == 'id'
390+
389391
if ForestLiana::SchemaHelper.is_smart_field?(association.klass, association_path)
390392
association.klass.attribute_names.each { |attribute| select << "#{table_name}.#{attribute}" }
391393
else

0 commit comments

Comments
 (0)