【发布时间】:2014-12-27 21:11:00
【问题描述】:
我正在尝试让我的应用在遇到错误时重定向到自定义路由:
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
我在app/views/tweets 中有一个名为too_many_requests.html.erb 的视图
我知道我一定做错了什么,但有人可以帮忙吗?
谢谢
【问题讨论】:
-
大概你的
too_many_requests.html.erb在某处有你的推特订阅源。 -
这就是我的想法,但
too_many_requests.html.erb目前是空的
标签: ruby-on-rails ruby-on-rails-4 twitter twitter-gem