2013-02-14 188 views
0

我有認證與Sorcery合作。當用戶註冊時,我想自動登錄他們用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 

回答

5

auto_login(user)應該做的伎倆:

... 

if @user.save 
    auto_login(@user) 
    flash[:success] = "Welcome to Christian" 
    redirect_to root_url 

...