数据库误删除的问题

This commit is contained in:
yanxd 2014-01-17 10:19:18 +08:00
parent 7eb5317696
commit 48172599cc
1 changed files with 13 additions and 13 deletions

View File

@ -13,19 +13,19 @@ class StoresController < ApplicationController
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
# }
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