Return distinct topics

This commit is contained in:
Chris Blanchard 2015-09-05 17:09:20 +01:00
parent 8200ff38a0
commit 6e4ebd4d1f

View file

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