mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 11:48:26 -06:00
Explicitly assign primary_email record when creating a user
* This looks like we're doing the same thing but we're debugging a race condition where a user can be created without an email record. Therefore, we prefer the more obvious method of assigning an association.
This commit is contained in:
parent
5ef75c9c61
commit
0e1b896821
@ -996,7 +996,7 @@ class User < ActiveRecord::Base
|
||||
if primary_email
|
||||
new_record? ? primary_email.email = new_email : primary_email.update(email: new_email)
|
||||
else
|
||||
build_primary_email(email: new_email)
|
||||
self.primary_email = UserEmail.new(email: new_email, user: self, primary: true)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user