我正在使用Octokit来登录。redirect_to没有工作到救援块
helper_method :user
def show
end
def user
client = Octokit::Client.new(access_token: session[:access_token])
begin
@user = client.user
rescue => e
redirect_to root_path
return
end
end
的root_path是在配置
root to: 'home#new'
救援ES执行,然而redirect_to的不工作,它返回到相同的视图的主要方法。注意:我在很多帖子中看到,将修复它,但它没有
从root_path中删除':'并确保root_path在config/routes.rb文件中定义。此外,'返回false'停止进一步的执行。 – bkunzi01
@ bkunzi01我拼错了。我更新了这篇文章。根被定义并且root_path被正确定义 –