From 6e4ebd4d1f8586b7fdb2d896bf113d0043c5a11c Mon Sep 17 00:00:00 2001 From: Chris Blanchard Date: Sat, 5 Sep 2015 17:09:20 +0100 Subject: [PATCH] Return distinct topics --- app/models/topic.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/topic.rb b/app/models/topic.rb index ea3cd43..4434206 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -43,7 +43,7 @@ class Topic < ActiveRecord::Base def self.recent_topics find_by_sql %q{ - SELECT topics.* + SELECT DISTINCT topics.* FROM (SELECT max(id) as max_id, topic_id FROM posts GROUP BY topic_id