Sfoglia il codice sorgente

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
tags/1.3.0
Toshi MARUYAMA 12 anni fa
parent
commit
7e017e6c2c
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2
    1
      app/models/user.rb

+ 2
- 1
app/models/user.rb Vedi 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)

Loading…
Annulla
Salva