FIX: Destroying a user failed when it had title

...because updating the user caused a validation of the primary email and the UserEmail records are already deleted at that time.
This commit is contained in:
Gerhard Schlager
2020-05-24 22:12:55 +02:00
parent 058bf56b4c
commit 13d5ccedf5
2 changed files with 9 additions and 1 deletions

View File

@@ -38,7 +38,7 @@ class GroupUser < ActiveRecord::Base
def grant_other_available_title
if group.title.present? && group.title == user.title
user.update!(title: user.next_best_title)
user.update_attribute(:title, user.next_best_title)
end
end