From f7045179c55040b18ad7c698cdf37194f95f0b06 Mon Sep 17 00:00:00 2001 From: Pavel Chipiga Date: Thu, 27 Oct 2011 21:13:55 +0300 Subject: [PATCH] Fix validation. Refs #2136 --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 0ed469b65..03d95fc53 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 {