2014-10-31 62 views
0

我试图让我的应用程序重定向到一个自定义的路由时遇到错误:此网页有重定向循环 - Rails的

Twitter::Error::TooManyRequests

不过,我有困难,出于某些原因我不断收到此错误:

This webpage has a redirect loop

这里是我的控制器:

#app/controllers/tweets_controller.rb 

rescue_from Twitter::Error::TooManyRequests, with: :too_many_requests 

    def too_many_requests 

     redirect_to too_many_requests_path 

    end 

这里是我的路线:

#config/routes.rb 

get "/too_many_requests", to: "tweets#too_many_requests", as: :too_many_requests 

我有一个名为too_many_requests.html.erb

我知道我一定是不正确的做事内app/views/tweets的视图,但有人可以帮忙吗?

感谢

+0

想必你'too_many_requests.html.erb'上有你的Twitter饲料的地方。 – 2014-10-31 14:02:20

+0

这就是我认为,但'too_many_requests.html.erb'目前是空的 – Robbo 2014-10-31 14:13:00

回答

3

除非我失去了一些东西,它看起来像你重定向动作本身:

def too_many_requests 
    # Error handling..... 

    # You should redirect this elsewhere 
    redirect_to some_other_path 
end 
+0

doh!你说得对,傻了,谢谢你看看 – Robbo 2014-10-31 14:24:34