devise: not requiring email

前端 未结 4 1548
你的背包
你的背包 2021-01-01 15:31

I would like to NOT require email for signing in using devise. I removed email from config/initializers/devise.rb:

config.authentication_keys = [ :login ]
         


        
4条回答
  •  一向
    一向 (楼主)
    2021-01-01 15:52

    It looks like you have the email field set in the database as "not NULL" or "Allow Null" to false. And you are getting an error directly from the database. Assuming that your user model is called user you need to add the fallowing migration to fix that:

    change_column :users, :email, :string, :null => true 
    

    Documentation: http://apidock.com/rails/ActiveRecord/ConnectionAdapters/SchemaStatements/change_column

提交回复
热议问题