Permalink
Browse files

随便看看列表修改为安插入日期倒序排列

  • Loading branch information...
1 parent 3779253 commit 2d80a0cd9ea6e5b116d11811ad163b5c0edeeed6 @huacnlee committed Mar 30, 2011
Showing with 2 additions and 1 deletion.
  1. +1 −1 app/controllers/asks_controller.rb
  2. +1 −0 app/models/ask.rb
@@ -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
View
@@ -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

0 comments on commit 2d80a0c

Please sign in to comment.