FIX: only validate username when changing it

This commit is contained in:
Neil Lalonde 2016-03-29 11:53:07 -04:00
parent b3354bdc7b
commit 54f8bdd13b
1 changed files with 1 additions and 1 deletions

View File

@ -69,7 +69,7 @@ class User < ActiveRecord::Base
before_validation :strip_downcase_email
validates_presence_of :username
validate :username_validator
validate :username_validator, if: :username_changed?
validates :email, presence: true, uniqueness: true
validates :email, email: true, if: :email_changed?
validate :password_validator