A platform for community discussion. Free, open, simple.
Explicitly assign primary_email record when creating a user
Guo Xiang Tan0e1b896821d1
diff --git a/app/models/user.rb b/app/models/user.rbindex f25099c27af..a2c60eb345d 100644--- a/app/models/user.rb+++ b/app/models/user.rb@@ -996,7 +996,7 @@ class User < ActiveRecord::Baseif primary_emailnew_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)endend