Skip to content

Commit

Permalink
Fixed a regression introduced by commit #54c57330c419a597078170143398…
Browse files Browse the repository at this point in the history
…b33427114ae0
  • Loading branch information
HollowerMan authored and radar committed Mar 17, 2014
1 parent e5bb7c9 commit da02394
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/models/forem/topic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ def by_most_recent_post
end

def by_pinned_or_most_recent_post
order('forem_topics.last_post_at DESC').order('forem_topics.pinned DESC')
#order('forem_topics.id')
order('forem_topics.pinned DESC').

This comment has been minimized.

Copy link
@cs3b

cs3b May 30, 2014

It looks like rails is applying chain of .order with reverse order :-) LIFO, so this change breaks desired behavior, it should be

      order('forem_topics.pinned DESC',
            'forem_topics.last_post_at DESC',
            'forem_topics.id')

or

    order('forem_topics.id').
    order('forem_topics.last_post_at DESC').
    order('forem_topics.pinned DESC')

how it was done before it was done right :-) #569

order('forem_topics.last_post_at DESC').
order('forem_topics.id')
end

def pending_review
Expand Down

0 comments on commit da02394

Please sign in to comment.