实训搜索优化

dev_forum
daiao 5 years ago
parent 036037df22
commit 79d1e96e36

@ -44,7 +44,7 @@ class ShixunsController < ApplicationController
## 搜索关键字 匹配关卡名, 用户名, 实训名 和 空格多搜索
if params[:keyword].present?
keyword = params[:keyword].strip
@shixuns = @shixuns.joins(:users, challenges: :challenge_tags).
@shixuns = @shixuns.joins(:user, challenges: :challenge_tags).
where("challenge_tags.name like '%#{keyword}%'
or challenges.subject like '%#{keyword}%'
or concat(lastname, firstname) like '%#{keyword}%'

Loading…
Cancel
Save