Reputation: 4278
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
Reputation: 168
latest rails 6 solution:
def update_resource(resource, params)
resource.update(params)
end
in your registrations_controller.rb file
Upvotes: 0
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
Reputation: 11967
Look at the devise wiki https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-edit-their-account-without-providing-a-password
Upvotes: 1