FIX: unable to save groups with mixed case names

This commit is contained in:
Neil Lalonde 2018-04-06 16:12:35 -04:00
parent f6cfff3cea
commit e33aef729f
1 changed files with 1 additions and 1 deletions

View File

@ -600,7 +600,7 @@ class Group < ActiveRecord::Base
self.name.downcase! self.name.downcase!
UsernameValidator.perform_validation(self, 'name') || begin UsernameValidator.perform_validation(self, 'name') || begin
if will_save_change_to_name? if will_save_change_to_name? && name_was&.downcase != self.name
existing = Group.exec_sql( existing = Group.exec_sql(
User::USERNAME_EXISTS_SQL, username: self.name User::USERNAME_EXISTS_SQL, username: self.name
).values.present? ).values.present?