From 68b9a7efc5c663da197ee61196fecc56cfc08d29 Mon Sep 17 00:00:00 2001 From: nwb Date: Tue, 27 May 2014 14:21:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=89=B9=E5=87=86=E6=88=90?= =?UTF-8?q?=E5=91=98=E7=94=B3=E8=AF=B7=E6=9C=AA=E9=80=89=E6=8B=A9=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E6=97=B6=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/members_controller.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index d8e583bf..30c6c7e8 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -76,8 +76,7 @@ class MembersController < ApplicationController # ProjectInfo.create(:name => "test", :user_id => 123) end ## end - AppliedProject.deleteappiled(user_id, @project.id) - end + end else members << Member.new(:role_ids => params[:membership][:role_ids], :user_id => params[:membership][:user_id]) user_grades << UserGrade.new(:user_id => params[:membership][:user_id], :project_id => @project.id) @@ -95,6 +94,13 @@ class MembersController < ApplicationController end end + if members.present? && members.all? {|m| m.valid? } + members.each do |member| + AppliedProject.deleteappiled(member.user_id, @project.id) + end + + end + respond_to do |format| format.html { redirect_to_settings_in_projects } format.js { @members = members;@applied_members = applied_members; }