Children::ApplicationController 引用的顶级常量 ApplicationController
我正在合并两个应用程序学校和儿童。每个工作都很好,儿童应用程序嵌套在学校应用程序中。他们每个人都有自己的数据库。 这是学校应用程序树的一部分:
应用程序/控制器/application_controller.rb
应用程序/控制器/user.rb
....
应用程序/控制器/子项/application_controller.rb
app/controllers/children/user.rb ....
并有这些警告:
Children::ApplicationController 引用的顶级常量 ApplicationController
Children::User 引用的顶级常量 User
app/controllers/children/application_controller.rb 中的 我有
子类::ApplicationController
动作控制器::基础
在 app/controllers/application_controller.rb 我有
类ApplicationController
ActionController::Base
嵌套的 ApplicationController 未加载。命名空间不起作用?
I am merging two applications school and children. Each working fine With children application nested in school application. Each of them have its own Database.
Here is part of the tree for school app:
app/controllers/application_controller.rb
app/controllers/user.rb
....
app/controllers/children/application_controller.rb
app/controllers/children/user.rb
....
and had these warning:
toplevel constant ApplicationController referenced by Children::ApplicationController
toplevel constant User referenced by Children::User
in app/controllers/children/application_controller.rb i have
class Children::ApplicationController < ActionController::Base
in app/controllers/application_controller.rb i have
class class ApplicationController < ActionController::Base
the nested ApplicationController is not loaded.the namespace is not working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
1-
顶级常量ApplicationController被Children::ApplicationController引用
我最终将两个applicationController合并到一个applicationController中,即在学校applicationController中添加嵌套applicatioController(Children)的内容,以便只有一个applicationController。
2-
Children::User 引用的顶级常量 User
我将 users_controller.rb 重命名为children_users_controller.rb。控制器中有第一行
class Children::ChildrenUsersController
class Children::ChildrenUsersController < Children::ApplicationController
这是一个名称冲突,即使它们来自两个不同的命名空间!从此处查找一些提示
希望有帮助
1-
toplevel constant ApplicationController referenced by Children::ApplicationController
I end up consolidating both applicationController in ONE applicationController ie adding content of the nested applicatioController (Children) in school applicationController to have just one applicationController.
2-
toplevel constant User referenced by Children::User
I renamed the users_controller.rb to children_users_controller.rb. And you have this first line in the controller
class Children::ChildrenUsersController < Children::ApplicationController
It was a name conflict even though they were from two different namespace! find some tips from here
hope it helps