sql 转义字符跑错的问题

This commit is contained in:
yanxd 2014-01-17 08:51:27 +08:00
parent 79e01adb91
commit b2bdf0c640
1 changed files with 1 additions and 1 deletions

View File

@ -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|