diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index d0be72961..ba312c74a 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -99,7 +99,7 @@ class MembersController < ApplicationController @project.members << members # added by nie @project.project_infos << project_info - @project.user_grades << user_grades + @project.user_grades << user_grades unless user_grades.first.user_id.nil? # end end if members.present? && members.all? { |m| m.valid? } @@ -108,7 +108,11 @@ class MembersController < ApplicationController end end if params[:flag] - flash[:notice] = l(:label_invite_success) + unless members.present? && members.all? {|m| m.valid? } + flash[:error] = members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ') + else + flash[:notice] = l(:label_invite_success) + end respond_to do |format| format.html { redirect_to invite_members_project_url(@project) } end