DEV: Let `create!` handle the check for persistence.

This is unlikely to fail but we want to know when it does.
This commit is contained in:
Guo Xiang Tan 2018-12-12 08:36:13 +08:00
parent 6797a710aa
commit 86926f4aee
1 changed files with 1 additions and 2 deletions

View File

@ -220,8 +220,7 @@ class InvitesController < ApplicationController
end
def send_activation_email(user)
email_token = user.email_tokens.create(email: user.email)
raise ActiveRecord::RecordInvalid.new(email_token) if !email_token.persisted?
email_token = user.email_tokens.create!(email: user.email)
Jobs.enqueue(:critical_user_email,
type: :signup,