我有与Sorcery合作的身份验证.当用户注册时,我想自动登录.
User_controller
def create @user = User.new(params[:user]) if @user.save flash[:success] = "Welcome to Christian" redirect_to root_url else render :new end
结束
auto_login(user)
应该做的伎俩:
... if @user.save auto_login(@user) flash[:success] = "Welcome to Christian" redirect_to root_url ...