Skip to content

Commit 7d8cf21

Browse files
committed
fix: uniq keys
1 parent 6405eef commit 7d8cf21

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/forest_liana/active_record_override.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def apply_column_aliases(relation)
3333
keys = [join_part.base_klass.primary_key] # Always include the primary key
3434

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

0 commit comments

Comments
 (0)