Fix validation. Refs #2136

This commit is contained in:
Pavel Chipiga 2011-10-27 21:13:55 +03:00
parent e7071b501b
commit f7045179c5
1 changed files with 1 additions and 1 deletions

View File

@ -23,7 +23,7 @@ class User < ActiveRecord::Base
include PersonalRepository
validates :uname, :presence => true, :uniqueness => {:case_sensitive => false}, :format => { :with => /^[a-zA-Z0-9_]+$/ }, :allow_nil => false, :allow_blank => false
validates :ssh_key, :uniqueness => true
validates :ssh_key, :uniqueness => true, :allow_blank => true
validate { errors.add(:uname, :taken) if Group.where('uname LIKE ?', uname).present? }
#TODO: Replace this simple cross-table uniq validation by more progressive analog
validate lambda {