I'm migrating the majority of my application to the admin namespace and while there are lots of guides related to this, I still can't manage. I've been primarily following this answer, along with any results Google brings up (they all tend to agree). Could somebody please tell me what I'm doing wrong so I don't lose any more sleep?
Here is the error message:
wrong argument type Module (expected Class)
app/controllers/application_controller.rb:1:in `<top (required)>'
app/controllers/admin/admin_controller.rb:1:in `<top (required)>'
app/controllers/admin/home_controller.rb:1:in `<top (required)>'
routes.rb
namespace :admin do
root :to => "home#index"
resources :users
end
admin/admin_controller.rb
class Admin::AdminController < ApplicationController
admin/home_controller.rb
class Admin::HomeController < Admin::AdminController
admin/users_controller.rb
class Admin::UsersController < Admin::AdminController
I'm mostly sure it's something simple to related to the module and controller interaction, so I haven't included any other code. However, I should have found the solution by now and please let me know if any additional code is required.
Thanks.
I encountered the reverse problem "wrong argument type Class (expected Module)" and it turned out there was a helper defined as a Class instead of a Module, so try searching for classes that are inadvertently defined as modules. Like a controller defined as a Module.
I'd suggest you rename Admin::AdminController
to Admin::BaseController
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With