Rails 从激活令牌加载未加载
Rails load from activation token does not load
我尝试从激活令牌加载用户以激活他,但不知何故失败了:
us = User.find(7)
us.activation_token
=> "BqgLeANnMj9jCCsTp2hy"
@user = User.load_from_activation_token(us.activation_token)
User Load (0.4ms) SELECT "users".* FROM "users" WHERE (activation_token = 'BqgLeANnMj9jCCsTp2hy') LIMIT 1
=> nil
尽管用户存在并且正在打开并且有一个激活令牌,load_from_activation_token 找不到它。还有其他激活用户的可能性吗?
us = User.find(7)
token = us.activation_token
=> "BqgLeANnMj9jCCsTp2hy"
@user = User.find_by_activation_token(token)
or
@user = User.find_by(activation_token: token)
or
@user = User.where(activation_token: token).first
我尝试从激活令牌加载用户以激活他,但不知何故失败了:
us = User.find(7)
us.activation_token
=> "BqgLeANnMj9jCCsTp2hy"
@user = User.load_from_activation_token(us.activation_token)
User Load (0.4ms) SELECT "users".* FROM "users" WHERE (activation_token = 'BqgLeANnMj9jCCsTp2hy') LIMIT 1
=> nil
尽管用户存在并且正在打开并且有一个激活令牌,load_from_activation_token 找不到它。还有其他激活用户的可能性吗?
us = User.find(7)
token = us.activation_token
=> "BqgLeANnMj9jCCsTp2hy"
@user = User.find_by_activation_token(token)
or
@user = User.find_by(activation_token: token)
or
@user = User.where(activation_token: token).first