Search code examples
ruby-on-railsauthenticationdevise

Devise update user password without password_confirmation


I want to update users password without password_confirmation in devise. In case password field is blank - password don't change. How could I do this with devise? Maybe use required_password?


Solution

  • it is not necessary to enter, password:

      def password_required?
        !persisted? || !password.nil? || !password_confirmation.nil?
      end
    

    https://github.com/plataformatec/devise/blob/master/lib/devise/models/validatable.rb

    string - 49