Rails devise edit user account without requiring password

Problem

Version of Ruby, Rails and Devise:

Solution

Create your registration controller in app/controllers/registrations_controller.rb

class RegistrationsController < Devise::RegistrationsController

  protected

  def update_resource(resource, params)
    # Require current password if user is trying to change password.
    return super if params["password"]&.present?

    # Allows user to update registration information without password.
    resource.update_without_password(params.except("current_password"))
  end
end

Tell Devise that you use your registrations controller defined in app/controllers/registrations_controller.rb.

# config/routes.rb
devise_for :users, controllers: { registrations: "registrations" }