From 7eb5317696ad80acdb9174738e2c7992894778ff Mon Sep 17 00:00:00 2001 From: yanxd Date: Fri, 17 Jan 2014 10:18:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=AF=AF=E5=88=A0?= =?UTF-8?q?=E9=99=A4=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 | 29 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/app/controllers/stores_controller.rb b/app/controllers/stores_controller.rb index ac78b5a22..6e7bbdc93 100644 --- a/app/controllers/stores_controller.rb +++ b/app/controllers/stores_controller.rb @@ -8,19 +8,24 @@ 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 :like ", like: "%#{name}%"). + resultSet = 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| - if(res.container.nil? || - (res.container.class.to_s=="Project" && res.container.is_public == false) || - (res.container.has_attribute?(:project) && res.container.project.is_public == false) || - (res.container.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) || - false - ) - result.delete(res) - end - } + + result = resultSet.to_a.dup + + # result.map { |res| + # if(res.container.nil? || + # (res.container.class.to_s=="Project" && res.container.is_public == false) || + # (res.container.has_attribute?(:project) && res.container.project.is_public == false) || + # (res.container.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) || + # false + # ) + # logger.debug("=====================================#{result.include? res}") + # logger.debug("=====================================#{res}") + # result.delete(res) + # logger.debug("=====================================#{result.include? res}") + # end + # } @searched_attach = paginateHelper result end