Validates presence of `UserEmail#user_id` in AR.

This commit is contained in:
Guo Xiang Tan 2017-11-08 11:43:41 +08:00
parent 7777a44673
commit 0dec3269d8
1 changed files with 1 additions and 0 deletions

View File

@ -7,6 +7,7 @@ class UserEmail < ActiveRecord::Base
before_validation :strip_downcase_email
validates :user_id, presence: true
validates :email, presence: true, uniqueness: true
validates :email, email: true, format: { with: EmailValidator.email_regex },