Merge remote-tracking branch 'origin/master' into gs-master

This commit is contained in:
David Yip committed 2018-03-27 10:44:12 -05:00
commit d2cdc2b5a3
18 files changed
+261 -111

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ class UniqueUsernameValidator < ActiveModel::Validator
normalized_username = account.username.downcase.delete('.')
scope = Account.where(domain: nil, username: normalized_username)
scope = Account.where(domain: nil).where('lower(username) = ?', normalized_username)
scope = scope.where.not(id: account.id) if account.persisted?
account.errors.add(:username, :taken) if scope.exists?