Reputation: 8689
I just created a sample application with devise plugin installed. I have :token_authenticatable
in my user model but for some reason when I create a user it creates it with authentication_token
column as NULL
.
It looks like you need to set u.ensure_authentication_token!
when creating a new user to generate a token.
Am I missing something or I need to override devise's code?
Upvotes: 7
Views: 4098
Reputation: 40277
In your user class, just add
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable #...etc
before_save :ensure_authentication_token
end
that's a devise method that will set your authentication_token.
Upvotes: 17