2014-10-31 31 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

相關問題