搜索实训时过滤掉删除的实训

dev_partners
cxt 6 years ago
parent 0817dc9e86
commit 5002fd8a5c

@ -940,7 +940,7 @@ class UsersController < ApplicationController
@limit = 16 @limit = 16
if 1 == @index if 1 == @index
# @shixuns_result = Shixun.where(:status => [2,3]).where("name like ?", "%#{@search}%").reorder("created_at desc") # @shixuns_result = Shixun.where(:status => [2,3]).where("name like ?", "%#{@search}%").reorder("created_at desc")
@shixuns_result = Shixun.where("name like ? and hidden=0", "%#{@search}%").reorder("myshixuns_count desc") @shixuns_result = Shixun.where("name like ? and hidden=0 and status != -1", "%#{@search}%").reorder("myshixuns_count desc")
@shixuns_result_count = @shixuns_result.count @shixuns_result_count = @shixuns_result.count
@shixun_pages = Paginator.new @shixuns_result_count, @limit, params['page'] || 1 @shixun_pages = Paginator.new @shixuns_result_count, @limit, params['page'] || 1
@offset ||= @shixun_pages.offset @offset ||= @shixun_pages.offset

Loading…
Cancel
Save