Rails3: model: replace deprecated 'validate' method at User model

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7431 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-09-21 06:14:11 +00:00
parent 80581538a1
commit 7e017e6c2c
1 changed files with 2 additions and 1 deletions

View File

@ -72,6 +72,7 @@ class User < Principal
validates_length_of :mail, :maximum => 60, :allow_nil => true
validates_confirmation_of :password, :allow_nil => true
validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
validate :validate_password_length
before_create :set_mail_notification
before_save :update_hashed_password
@ -546,7 +547,7 @@ class User < Principal
protected
def validate
def validate_password_length
# Password length validation based on setting
if !password.nil? && password.size < Setting.password_min_length.to_i
errors.add(:password, :too_short, :count => Setting.password_min_length.to_i)