更新时间:2023-09-28 21:56:58
您还可以使用以下方法在设计用户表中添加自定义字段。
You can also use following approach to add custom field in devise user table.
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
before_filter :configure_permitted_parameters, if: :devise_controller?
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:firstname, :lastname, :email, :password, :password_confirmation) } # The :firstname and :lastname are my custom fields.
end
protect_from_forgery with: :exception
end