Adding name attribute to `User` in Devise

后端 未结 8 1639
轻奢々
轻奢々 2020-12-31 00:31

I\'m trying to add a name attribute to the User model provided by Devise. I added a \"name\" column to my database, and changed the sign up view so that it asks for the use

8条回答
  •  伪装坚强ぢ
    2020-12-31 01:09

    uncomment some of the generated code:

    class Users::RegistrationsController < Devise::RegistrationsController
      before_filter :configure_sign_up_params, only: [:create]
    
      protected
    
      def configure_sign_up_params
        devise_parameter_sanitizer.for(:sign_up) << :name
      end
    end
    

提交回复
热议问题