Skip to content

Commit

Permalink
Merge pull request #152 from jgadbois/issue_150
Browse files Browse the repository at this point in the history
Specify DISTINCT clause on `by_pinned_or_most_recent_post` - fixes #151
  • Loading branch information
radar committed Feb 20, 2012
2 parents 7fdcbc0 + a2f56bb commit 0d6f46c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions app/models/forem/topic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def by_most_recent_post

def by_pinned_or_most_recent_post
joins(:posts).
select("DISTINCT forem_topics.id, forem_topics.*").
order('forem_topics.pinned DESC').
order('forem_posts.created_at DESC').
order('forem_topics.id')
Expand Down

0 comments on commit 0d6f46c

Please sign in to comment.