From cfebe9746f04ca2baccff559979abcebca3722dd Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 30 Aug 2019 19:01:04 +0800 Subject: [PATCH] tiaoz --- app/controllers/managements_controller.rb | 6 +++--- app/models/course_group.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 8f15d572..8f851e53 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -2967,7 +2967,7 @@ end member = course.course_members.where(:user_id => user.id, :role => member_role).first # 如果已是课堂成员且是学生身份and不在指定的分班则移动到该分班 if member.present? && member.role == 4 && member.course_group_id != course_group.try(:id).to_i - member.update_column("course_group_id", course_group.try(:id).to_i) + member.update_attributes(course_group_id: course_group.try(:id).to_i) member_count += 1 elsif !member.present? member = CourseMember.new(:role => member_role, :user_id => user.id) @@ -2988,9 +2988,9 @@ end @status = 1 @message = "已导入/更新#{member_count}个成员" end - rescue + rescue Exception => e @status = 0 - @message = "文件内容无法读取" + @message = e.message end else @status = 0 diff --git a/app/models/course_group.rb b/app/models/course_group.rb index d158e68f..2986e6ac 100644 --- a/app/models/course_group.rb +++ b/app/models/course_group.rb @@ -1,6 +1,6 @@ class CourseGroup < ActiveRecord::Base # attr_accessible :title, :body - belongs_to :course, counter_cache: true + belongs_to :course, :counter_cache => true has_many :course_members has_many :members has_many :memberships, :class_name => 'Member'