From c686ae8d8fbfe6f43b4afa48cfc5a8e5ae5be525 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 22 Mar 2018 16:38:53 -0400 Subject: [PATCH] FIX: Ambiguous column name --- lib/topic_query.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/topic_query.rb b/lib/topic_query.rb index 4a9b823f92e..a2275b89e5f 100644 --- a/lib/topic_query.rb +++ b/lib/topic_query.rb @@ -289,8 +289,8 @@ class TopicQuery def list_category_topic_ids(category) query = default_results(category: category.id) - pinned_ids = query.where('pinned_at IS NOT NULL AND category_id = ?', category.id).limit(nil).order('pinned_at DESC').pluck(:id) - non_pinned_ids = query.where('pinned_at IS NULL OR category_id <> ?', category.id).pluck(:id) + pinned_ids = query.where('topics.pinned_at IS NOT NULL AND topics.category_id = ?', category.id).limit(nil).order('pinned_at DESC').pluck(:id) + non_pinned_ids = query.where('topics.pinned_at IS NULL OR topics.category_id <> ?', category.id).pluck(:id) (pinned_ids + non_pinned_ids) end