Since the controller of devise cannot be tampered with, operate by writing the following in ʻapprication.controller.rb`.
apprication.controller.rb
params.require(:Model name).permit(:Keys to allow) #Normal strong parameters
devise_parameter_sanitizer.permit(:devise process name, keys: [:Allowed column name]) # devise_parameter_strong parameters of sanitizer
: sign_in (when performing sign-in processing) : sign_up (when performing sign-up processing) : account_update (when processing account information update)
if before_action is a devise helper method that executes processing only when the return value is true. For controller processing related to devise, execute the configure_permitted_parameters method.
apprication.controller.rb
class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
private
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:Process name, keys: [:Column name])
end
end
Recommended Posts