FIX: change title when primary group changes (#6602)

This commit is contained in:
Kyle Zhao
2018-11-13 19:28:41 -05:00
committed by Guo Xiang Tan
parent fc9aafaa6a
commit 38a9bc740d
2 changed files with 9 additions and 11 deletions

View File

@ -24,14 +24,7 @@ class GroupUser < ActiveRecord::Base
end
def set_primary_group
if group.primary_group
DB.exec("
UPDATE users
SET primary_group_id = :id
WHERE id = :user_id",
id: group.id, user_id: user_id
)
end
user.update!(primary_group: group) if group.primary_group
end
def remove_primary_group