This commit is contained in:
Rahul 2017-08-01 08:30:31 +00:00 committed by GitHub
commit 8c967a9f6b

View file

@ -64,7 +64,8 @@ class User < ActiveRecord::Base
scope :admin, -> { where(is_admin: true) } scope :admin, -> { where(is_admin: true) }
scope :active, -> { where(is_disabled: false) } scope :active, -> { where(is_disabled: false) }
validates :email, presence: true VALID_EMAIL_REGEX = /\A([\w+\-].?)+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i
validates :email, presence: true, format: {with: VALID_EMAIL_REGEX }
validates :username, validates :username,
uniqueness: { uniqueness: {