Mikhail Grishko
Mikhail Grishko

Reputation: 4278

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?

Upvotes: 0

Views: 3585

Answers (3)

saffront
saffront

Reputation: 168

latest rails 6 solution:

  def update_resource(resource, params)
    resource.update(params)
  end

in your registrations_controller.rb file

Upvotes: 0

Mikhail Grishko
Mikhail Grishko

Reputation: 4278

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

Upvotes: 1

Related Questions