Rails 路由问题,操作被跳过

发布于 2024-10-24 03:54:12 字数 280 浏览 0 评论 0原文

我遇到了一个奇怪的问题,Rails 似乎正在跳过我的特定操作的运行。我有两个环境在其中运行。其中一个(开发)工作正常并运行该操作。另一个(暂存)未运行该操作。

错误是 Rails 无法在视图目录中找到我给定操作的模板,该操作只应该使用 JSON 进行响应(无模板)。我已经完成了操作的登录,但它只是没有运行。 Rails 立即失败并表示该视图不存在。

为了覆盖我的基础,我已经验证了代码确实是相同的,我的路线文件是完全相同的,并且我的 Rails 版本(3.0.1)在两个环境之间是完全相同的。任何帮助都会非常好。

I'm having a bizarre issue where it seems as if Rails is skipping the run of my particular Action. I have two environments that I am running this in. One (development) works fine and runs the action. The other (staging) is not running the action.

The error is that Rails can't find a template in the views directories for my given action, which is only supposed to respond with JSON (no template). I've done logging in the action and it just simply isn't being run. Rails immediately fails saying that the view doesn't exist.

Just to cover my bases, I've verified that the code is indeed the same, that my routes file is exactly the same, and that my rails version (3.0.1) is exactly the same between the two env's. Any help would be excellent here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

感受沵的脚步 2024-10-31 03:54:12

显然这属于脸部护理部门。我们的一位开发人员提交了一个新的控制器,其文件名与另一个控制器的文件名不同,但控制器类名相同。肯定是在开发轨道中首先加载新控制器,因此旧控制器会覆盖它并且问题被隐藏了。然而,在阶段中,似乎新控制器是最后加载的,这会蚕食我们的控制器类和方法,将一切搞砸。

我很想知道其他人是否在 Rails 中遇到过这个问题。可能需要修补控制器加载代码以始终使用相同的排序机制(似乎文件名是最自然的)。

Apparently this comes in the department of facepalm. One of our developers had committed a new controller with a different file name but the same controller class name as another. It must be that in development rails was loading the new controller first, and so the old controller would override it and the issue was hidden. In stage however, it seems that the new controller was loaded last, which cannibalized our controller class and method, screwing everything up.

I'd be interested to know if others have encountered this problem in rails. May need to patch the controller loading code to always use the same sort mechanism (seems like file name would be most natural).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文