|
|
|
@ -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)
|
|
|
|
|