From b2bdf0c64024885db889e2c6bd5672fc3b5ef3b3 Mon Sep 17 00:00:00 2001 From: yanxd Date: Fri, 17 Jan 2014 08:51:27 +0800 Subject: [PATCH] =?UTF-8?q?sql=20=E8=BD=AC=E4=B9=89=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E8=B7=91=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/stores_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/stores_controller.rb b/app/controllers/stores_controller.rb index bff90c75f..ac78b5a22 100644 --- a/app/controllers/stores_controller.rb +++ b/app/controllers/stores_controller.rb @@ -8,7 +8,7 @@ class StoresController < ApplicationController name = params[:name] ||= '' redirect_to stores_path, :notice => l(:field_course_un) if name.blank? # 按文件名搜索 - result = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE '%" + name + "%' "). + result = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE :like ", like: "%#{name}%"). reorder("created_on DESC") # result = result.to_a result.map { |res|