In implementing the user management function, when devise was introduced and new registration was attempted, a title error occurred. The solution and cause are described below.
Set the strong parameters of devise. A code example is shown below.
application_controller
class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
private
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:nickname, :first_name,(Multiple column names)])
end
end
The content of the error statement is "The column name specified in mysql is not set with the default value". The only columns set by default in devise are email and password. Therefore, even if you try to save other columns through devise, you cannot save the user information.
The above code allows columns other than email and password to be saved as user information through devise. Therefore, columns that are not set by default can be saved and the error is resolved.
Recommended Posts