File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
app/services/forest_liana Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -304,7 +304,21 @@ def compute_select_fields
304304 association = get_one_association ( association . options [ :through ] )
305305 end
306306
307+ # For ActiveStorage associations, include all required columns
307308 if is_active_storage_association? ( association )
309+ # Include all columns from ActiveStorage tables to avoid initialization errors
310+ table_name = association . table_name
311+ association . klass . column_names . each do |column_name |
312+ select << "#{ table_name } .#{ column_name } "
313+ end
314+
315+ # Also include the foreign key from the main resource (e.g., blob_id, record_id)
316+ if association . macro == :belongs_to || association . macro == :has_one
317+ foreign_keys = Array ( association . foreign_key )
318+ foreign_keys . each do |fk |
319+ select << "#{ @resource . table_name } .#{ fk } "
320+ end
321+ end
308322 next
309323 end
310324
You can’t perform that action at this time.
0 commit comments