2017-01-10 87 views
2

我試圖登錄並將用戶重定向到home_path如果滿足某些條件,否則它們未被批准並被重定向到另一個頁面。當我通過控制器登錄用戶時,他們被重定向到users#show雖然(users /:id)。從控制器登錄用戶後設計重定向

我怎樣才能讓他們登錄,並從註冊控制器重定向到home_path'profile/home'

註冊控制器:

def after_inactive_sign_up_path_for(resource) 
    if resource.location === "New York, NY, United States" 
     if (really long query) 
     puts "accepted!" 
     resource.approved = true 
     resource.save! 
     sign_in(resource) 
     home_path 
     else 
     puts "Not accepted" 
     '/profile/waitlist' 
     end 
    else 
     puts "City is not New York!" 
     '/profile/waitlist' 
    end 
end 

應用控制器

def after_sign_in_path_for(resource) 
    home_path 
end 

預先感謝您

回答