问吧右下角贴吧排序按照帖子发布数和回帖数之和排序

This commit is contained in:
daiao 2017-02-23 13:39:44 +08:00
parent b36c249a6b
commit 6d14cb131a
1 changed files with 1 additions and 1 deletions

View File

@ -143,7 +143,7 @@ class ForumsController < ApplicationController
reorder(order).
preload(:author, {:last_reply => :author}).
all
@forums = Forum.reorder("topic_count desc,updated_at desc")
@forums = Forum.find_by_sql("SELECT *,topic_count + memo_count tm FROM `forums` order by tm desc;")
@my_forums_count = Memo.where("author_id =? and parent_id is null", User.current.id).count
@my_memos_count = Memo.where("author_id =? and parent_id is not null", User.current.id).count
@errors = params[:errors]