From e269f32591c3b3907b20751b68c39d5d027247d6 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 21 Jun 2019 17:33:04 +0800 Subject: [PATCH] fix --- app/controllers/messages_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 5569ec165..3dac97899 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -22,13 +22,13 @@ class MessagesController < ApplicationController messages = @board.messages.root_nodes.by_keywords(params[:search]) - messages = messages.order('(sticky = 1) DESC') # 置顶 + messages = messages.reorder('(sticky = 1) DESC') # 置顶 messages = case sort_type - when 'time' then messages.reorder("created_on #{sort}") - when 'hot' then messages.reorder("descendants_count #{sort}") - else messages.reorder("created_on #{sort}") + when 'time' then messages.order("created_on #{sort}") + when 'hot' then messages.order("descendants_count #{sort}") + else messages.order("created_on #{sort}") end messages = messages.includes(:author)