Devise: authentication_token column in user model is null

I just created a sample application with the plugin installed. I have :token_authenticatable in my user model, but for some reason, when I create the user, it creates it with the authentication_token column as NULL .

Looks like you need to set u.ensure_authentication_token! when creating a new user to create a token.

Am I missing something or do I need to override the development code?

+7
source share
1 answer

In your custom class just add

 class User < ActiveRecord::Base devise :database_authenticatable, :registerable #...etc before_save :ensure_authentication_token end 

what is a development method that will set your authentication_token.

+17
source

All Articles