Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/forest_liana/active_record_override.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def apply_column_aliases(relation)
keys = [join_part.base_klass.primary_key] # Always include the primary key

# # %%% Optional to include all foreign keys:
# keys.concat(join_part.base_klass.reflect_on_all_associations.select { |a| a.belongs_to? }.map(&:foreign_key))
keys.concat(join_part.base_klass.reflect_on_all_associations.select { |a| a.belongs_to? }.map(&:foreign_key)).compact.uniq
# Add foreign keys out to referenced tables that we belongs_to
join_part.children.each { |child| keys << child.reflection.foreign_key if child.reflection.belongs_to? }

Expand Down
Loading