Skip to content

Commit 5b458c9

Browse files
committed
fixed SQL error on complex tag queries
1 parent e61ca3f commit 5b458c9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

app/models/tag.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def self.search(term)
3333
.order(Arel.sql(sanitize_sql_array(['sortname LIKE ? DESC, sortname', "#{sanitize_sql_like(stripped)}%"])))
3434

3535
# Select from the union of the above queries, select only the tag columns such that we can distinct them
36-
from(Arel.sql("(#{q1.to_sql} UNION #{q2.to_sql}) tags"))
36+
from(Arel.sql("((#{q1.to_sql}) UNION (#{q2.to_sql})) tags"))
3737
.select(Tag.column_names.map { |c| "tags.#{c}" })
3838
.distinct
3939
end

0 commit comments

Comments
 (0)