0
我有一个字段auth_token
,我希望每次用户登录时都会生成一个新的令牌。 因此,我写行(2)
,但它不起作用。用户登录成功,但字段auth_token
不更新。使用魔法登录后无法更新属性
有人可以解释一下吗?
if login(params[:email], params[:password])
current_user.update(auth_token: 'sfd') #(2)
flash[:success] = 'Welcome back!'
redirect_to root_path
else
flash.now[:warning] = 'E-mail and/or password is incorrect.'
render 'new'
end
P.S.我用Sorcery
宝石