From 59e643393855d988f3f39918b69bdfc83f6eaa95 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 19 Jun 2014 16:52:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E7=94=A8=E6=88=B7=E5=BB=BA=E7=AB=8B=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE=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/helpers/homework_attach_helper.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/helpers/homework_attach_helper.rb b/app/helpers/homework_attach_helper.rb index 4fbedb3a1..fe7f123bd 100644 --- a/app/helpers/homework_attach_helper.rb +++ b/app/helpers/homework_attach_helper.rb @@ -56,13 +56,17 @@ module HomeworkAttachHelper end def user_projects_option - projects = Project.where("id < 8") + cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" + memberships = User.current.memberships.all(:conditions => cond) + projects = memberships.map(&:project) type = [] projects.each do |project| - option = [] - option << project.name - option << project.id - type << option + if project != nil + option = [] + option << project.name + option << project.id + type << option + end end type end