Luc
Luc

Reputation: 17082

How to reset authentication token right after user creation

In ActiveAdmin, when I create a new user (not an admin user) and then check in the console, the authentication_token is nil. I need to manually issue reset_authencation_token! on the user so he can connect.
How can I populate this token right after the user is created ?

Upvotes: 0

Views: 367

Answers (1)

Leonel Galán
Leonel Galán

Reputation: 7167

before_save :ensure_authentication_token

Add this to your User model. You don't have to use before_save any similar hook will do.

Upvotes: 2

Related Questions