Skip to content
This repository has been archived by the owner on Mar 6, 2018. It is now read-only.

Commit

Permalink
随便看看列表修改为安插入日期倒序排列
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Mar 30, 2011
1 parent 3779253 commit 2d80a0c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/asks_controller.rb
Expand Up @@ -6,7 +6,7 @@ class AsksController < ApplicationController

def index
@per_page = 10
@asks = Ask.normal.includes(:user,:last_answer,:last_answer_user,:topics).desc(:id).paginate(:page => params[:page], :per_page => @per_page)
@asks = Ask.normal.recent.includes(:user,:last_answer,:last_answer_user,:topics).paginate(:page => params[:page], :per_page => @per_page)
end

def show
Expand Down
1 change: 1 addition & 0 deletions app/models/ask.rb
Expand Up @@ -35,6 +35,7 @@ class Ask
# 正常可显示的问题, 前台调用都带上这个过滤
scope :normal, where(:spams_count.lt => Setting.ask_spam_max)
scope :last_actived, desc(:answered_at)
scope :recent, desc("$natural")

before_save :fill_default_values
def fill_default_values
Expand Down

0 comments on commit 2d80a0c

Please sign in to comment.