Admin 命名空间中的 UsersController 是否被视为定义 UsersController?

发布于 2024-09-13 10:51:00 字数 794 浏览 3 评论 0原文

在 Rails 控制台中我得到以下信息:

<块引用>

>>用户控制器

LoadError:需要 /../app/controllers/admin/users_controller.rb 定义 UsersController

我正在使用 Rails 3.0.0.rc。 顺便说一句,完全相同的代码适用于 3.0.0.beta3 和 3.0.0.beta4。

简而言之,控制器看起来像:

app/controllers/admin/users_controller.rb

class Admin::UsersController < AdminController
...
end

app/controllers/admin_controller.rb

class AdminController < ApplicationController
...
end

app/controllers/users_controller.rb

class UsersController < ApplicationController
...
end

我已经使用过这个管理工具很多次了(我们不是都:))..但从来没有遇到过这个奇怪的问题。 所有文件都已加载,这应该是简单的事情。我想我在某个地方做了一些愚蠢的事情:)。

非常感谢!

In rails console I get the following:

>> UsersController

LoadError: Expected /../app/controllers/admin/users_controller.rb to define UsersController

I'm using Rails 3.0.0.rc.
Exact same code works fine for 3.0.0.beta3 and 3.0.0.beta4 BTW.

In short the controllers look like:

app/controllers/admin/users_controller.rb

class Admin::UsersController < AdminController
...
end

app/controllers/admin_controller.rb

class AdminController < ApplicationController
...
end

app/controllers/users_controller.rb

class UsersController < ApplicationController
...
end

I've used this Admin stuff many time (haven't we all :) ).. but never got this weird issue.
All files are loaded and this should be straight forward thing. Guess I'm doing smth stupid somewhere :).

Many thanks!

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

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

发布评论

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

评论(1

各自安好 2024-09-20 10:51:00

只要注意你的...

app/controllers/admin/users_contoller.rb

控制器拼写错误,缺少 r。我猜你的帖子可能有错别字
但谁知道呢,值得仔细检查,因为这通常就是错误的含义。

Just notice your...

app/controllers/admin/users_contoller.rb

controller is spelled wrong, missing r. I'm guessing that might have been a typo in your post,
but who knows, it's worth to double check because that's usually what the error means.

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