Admin 命名空间中的 UsersController 是否被视为定义 UsersController?
在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只要注意你的...
控制器拼写错误,缺少 r。我猜你的帖子可能有错别字
但谁知道呢,值得仔细检查,因为这通常就是错误的含义。
Just notice your...
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.