toplevel constant ApplicationController referenced by Children::ApplicationController

671 views Asked by At

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?

1

There are 1 answers

0
mamesaye On

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