From edd68baa85de4e0b4d82f7ce1d41927cbebbbb6f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 24 Nov 2014 15:56:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BD=93=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E9=99=84=E4=BB=B6=E6=97=B6=E8=80=81=E5=B8=88?= =?UTF-8?q?=E8=83=BD=E6=89=93=E5=8C=85=E4=B8=8B=E8=BD=BD=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E7=A9=BA=E5=8C=85=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/zipdown_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index d7f9fa0ac..6cbe0dd95 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -21,7 +21,13 @@ class ZipdownController < ApplicationController def assort if params[:obj_class] == "Bid" bid = Bid.find params[:obj_id] - zipfile = zip_bid bid + file_count = 0 + bid.homeworks.map { |homework| file_count += homework.attachments.count} + if file_count > 0 + zipfile = zip_bid bid + else + render file: 'public/no_file_found.html' + end else logger.error "[ZipDown#assort] ===> #{params[:obj_class]} unKown !!" end