FIX: Ambiguous column name

This commit is contained in:
Robin Ward 2018-03-22 16:38:53 -04:00
parent 41fc8e32e2
commit c686ae8d8f
1 changed files with 2 additions and 2 deletions

View File

@ -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