学生身份的编辑

This commit is contained in:
cxt 2016-08-26 19:39:41 +08:00
parent 816a480991
commit 0047f7bfdf
1 changed files with 3 additions and 0 deletions

View File

@ -52,6 +52,9 @@ class Member < ActiveRecord::Base
ids += member_roles.select {|mr| !mr.inherited_from.nil?}.collect(&:role_id)
new_role_ids = ids - role_ids
if (new_role_ids.include?(7) || new_role_ids.include?(9)) && role_ids.include?(10)
member_roles.where("role_id = 10").first.update_column('is_current', 0)
end
# Add new roles
if new_role_ids.include?(7) && new_role_ids.include?(10)
member_roles << MemberRole.new(:role_id => 7)