Return distinct topics

This commit is contained in:
Chris Blanchard 2015-09-05 17:09:20 +01:00
parent bafb67f702
commit fc7dd7286e

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