0
私のユーザモデルに追加のフィールドを追加し、それに応じてconfigure_account_update_paramsメソッドを更新しました。ユーザーが現在のパスワードを入力しなくても情報を更新できるようになるまで、すべての作業が行われていました。Devise update_without_passwordがForbiddenAttributesErrorを返す
だから私は、ビューのフィールドを取り出して、これは私のコントローラであるRegistrationsController
で更新方法を変更し、私が考案するよると何か
class Users::RegistrationsController < Devise::RegistrationsController
before_filter :configure_account_update_params, only: [:update]
def update
resource.update_without_password(resource_params)
end
# If you have extra params to permit, append them to the sanitizer.
def configure_account_update_params
devise_parameter_sanitizer.for(:account_update) << [:first_name, :last_name, :country, :phone_number, :gender, :birthdate]
end
end
「configure_account_update_params」と一緒にそれを行いました。ありがとう –