正在采用一种批准模式。 核准有:电子邮箱。 所以说自己。 email is calls an Object of the ratification category with its email Depende.enter Code here
def associate_correct_user
new_user = User.find_or_create_by_email self.email do |u|
u.invite!
end
If I am creating a user here I need to pass two other attributes (first_name and last_name). Those attributes need to be pulled from another model Email, for which self.email as already been validated against.
这是我所领导的意思:
def associate_correct_user
new_user = User.find_or_create_by_email self.email do |u|
user = Email.find_by_email(self.email)
u.first_name = user.first_name
u.last_name = user.last_name
u.invite!
end
这为用户创造了条件,但并没有为这一新用户确定第一个名称和最后名称特征。