课程搜索按时间倒序排序

This commit is contained in:
lizanle 2015-04-16 15:48:15 +08:00
parent 05c74960a8
commit 45d5f9e58b
1 changed files with 2 additions and 2 deletions

View File

@ -40,9 +40,9 @@ class CoursesService
end end
@courses = courses_all.visible(current_user) @courses = courses_all.visible(current_user)
if params[:name].present? if params[:name].present?
@courses_all = @courses.like(params[:name]) @courses_all = @courses.like(params[:name]).order("created_at desc")
else else
@courses_all = @courses; @courses_all = @courses.order("created_at desc");
end end
@courses_all @courses_all
course_list = [] course_list = []