diff --git a/activemodel/lib/active_model/secure_password.rb b/activemodel/lib/active_model/secure_password.rb index f6ad35769fa29..8f2a069ba35de 100644 --- a/activemodel/lib/active_model/secure_password.rb +++ b/activemodel/lib/active_model/secure_password.rb @@ -75,7 +75,7 @@ def has_secure_password(options = {}) end validates_length_of :password, maximum: ActiveModel::SecurePassword::MAX_PASSWORD_LENGTH_ALLOWED - validates_confirmation_of :password, if: ->{ password.present? } + validates_confirmation_of :password, allow_blank: true end # This code is necessary as long as the protected_attributes gem is supported.