Created
June 28, 2011 13:48
-
-
Save knewter/1051166 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Here's what the scope was before | |
scope :by_most_recent_post, joins(:posts).order('forem_posts.created_at DESC, forem_topics.id').group('topic_id') | |
scope :by_pinned_or_most_recent_post, includes(:posts). | |
order('forem_topics.pinned DESC'). | |
order('forem_posts.created_at DESC'). | |
order('forem_topics.id') | |
# Here's what it likely should be, based on the by pinned or most recent scope | |
scope :by_most_recent_post, includes(:posts).order('forem_posts.created_at DESC) | |
scope :by_pinned_or_most_recent_post, includes(:posts). | |
order('forem_topics.pinned DESC'). | |
order('forem_posts.created_at DESC'). | |
order('forem_topics.id') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment