Rails3: replace deprecated Errors#on to Errors#[] at app/models/mail_handler.rb
On Rails2, Errors#[] returns single error if one error raises. But, on Rails3, Errors#[] always returns the array. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8520 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
d7856a4b74
commit
f01dc24877
|
@ -346,9 +346,9 @@ class MailHandler < ActionMailer::Base
|
|||
user.language = Setting.default_language
|
||||
|
||||
unless user.valid?
|
||||
user.login = "user#{ActiveSupport::SecureRandom.hex(6)}" if user.errors.on(:login)
|
||||
user.firstname = "-" if user.errors.on(:firstname)
|
||||
user.lastname = "-" if user.errors.on(:lastname)
|
||||
user.login = "user#{ActiveSupport::SecureRandom.hex(6)}" unless user.errors[:login].blank?
|
||||
user.firstname = "-" unless user.errors[:firstname].blank?
|
||||
user.lastname = "-" unless user.errors[:lastname].blank?
|
||||
end
|
||||
|
||||
user
|
||||
|
|
Loading…
Reference in New Issue