From: Toshi MARUYAMA Date: Wed, 21 Sep 2011 06:14:11 +0000 (+0000) Subject: Rails3: model: replace deprecated 'validate' method at User model X-Git-Tag: 1.3.0~537 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7e017e6c2cc5fe5cef55b564d37f67f302d3db1b;p=redmine.git 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 --- diff --git a/app/models/user.rb b/app/models/user.rb index 50f45270a..b3622024e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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)