Rails 路由在生产中被破坏 - 怀疑对routes.rb进行缓存
更新:原来这个问题是因为我的一半杂种没有重新启动。感谢大家的帮助!
大家好,我有一个紧急问题。本质上,我的路由在我的本地主机上运行。但是当我将其部署到生产中时,路线似乎无法正常工作。
例如,给定一个新路由“/invites” - 有时我会得到 404,有时它会正常工作。
我怀疑某处正在进行一些缓存,但我不确定。
日志:当找不到页面时(当路线应该准确时)
处理UsersController#network (对于 2010-06-01 的 67.180.78.126 09:59:31) [获取] 参数: {“id”=>“新”}
ActionController::RoutingError(否 路线匹配 “/comm/role_playing_games”与 {}):
应用程序/控制器/application_controller.rb:383:in上一页标签'
log_timed_info'
应用程序/控制器/application_controller.rb:238:in
应用程序/控制器/users_controller.rb:155:in网络'
网络'
应用程序/控制器/users_controller.rb:151:in
应用程序/控制器/application_controller.rb:44:inturn_on_query_caching'
turn_on_query_caching'
应用程序/控制器/application_controller.rb:43:in
应用程序/控制器/application_controller.rb:42:inturn_on_query_caching'
turn_on_query_caching'
应用程序/控制器/application_controller.rb:41:in
应用程序/控制器/application_controller.rb:40:inturn_on_query_caching'
turn_on_query_caching'haml (3.0.6) lib/sass/plugin/rack.rb:41:在“调用”
应用程序/控制器/application_controller.rb:39:in渲染 /mnt/app/releases/20100524233313/public/404.html (404未找到)
Update: Turns out that this problem was because half my mongrel did not restart. Thanks all for help!
Hi folks, i have an urgent problem. Essentially, my routing works on my localhost. But when i deployed this to production, the routes does not seem to work correctly.
For example, given a new route "/invites" - sometimes i will get a 404, and sometimes it will work correctly.
I suspect there is some caching going on somewhere, but i am not sure.
Logs: when a page is not found (when the routes are supposed to be accurate)
Processing UsersController#network
(for 67.180.78.126 at 2010-06-01
09:59:31) [GET] Parameters:
{"id"=>"new"}ActionController::RoutingError (No
route matches
"/comm/role_playing_games" with {}):
app/controllers/application_controller.rb:383:inprev_page_label'
log_timed_info'
app/controllers/application_controller.rb:238:in
app/controllers/users_controller.rb:155:innetwork'
network'
app/controllers/users_controller.rb:151:in
app/controllers/application_controller.rb:44:inturn_on_query_caching'
turn_on_query_caching'
app/controllers/application_controller.rb:43:in
app/controllers/application_controller.rb:42:inturn_on_query_caching'
turn_on_query_caching'
app/controllers/application_controller.rb:41:in
app/controllers/application_controller.rb:40:inturn_on_query_caching'
turn_on_query_caching' haml (3.0.6)
app/controllers/application_controller.rb:39:in
lib/sass/plugin/rack.rb:41:in `call'Rendering
/mnt/app/releases/20100524233313/public/404.html
(404 Not Found)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从您发布的内容来看,这绝对不是缓存或路由问题。
听起来您正在尝试生成一个指向该人在
ApplicationController
内所在的上一页的链接,并且您有一个错误。您必须发布application_controller.rb
中的相关代码。From the little you have posted, this definitely isn't a caching or routing problem.
It sounds like you are trying to generate a link to the previous page the person was on inside
ApplicationController
and you have a bug with it. You will have to post the relevant code fromapplication_controller.rb
.您是否确定重新启动了服务器(例如 apache、ngix 或乘客)?
另外,有时浏览器可以缓存网址,只需关闭浏览器并重新打开它,看看是否可以解决问题。
另外,我偶尔会忘记将代码推送到 GIT,因此生产服务器无法获取最新的代码。只需检查您的服务器是否确实有该代码即可。
Did you make sure you restarted your server (like apache, ngix or passenger)?
Also, sometimes a browser can cache urls, just close your browser and reopen it, see if that fixes it.
Also, once in a blue moon, I'll forget to push the code to GIT and therefore production server doesn't get the latest code. Just check that your server actually has the code there.