Module loading

I’ve looked high and low for the answer to this and can’t seem to find
anything that helps.

I have an admin section (much like Typo) where all controllers are based
on the Admin::BaseController.

My directory structure is
[RAILS]
-app
–controllers
—admin
----base_controller.rb
----products_controller.rb

Products controller is:
class Admin::ProductsController < Admin::BaseController
end

base_controller.rb is:
class Admin::BaseController
end

However I keep getting this error:
NameError: Cannot load module Admin: Object::Admin is set to Admin

Can anyone help me out with this, please?

Shouldn’t the BaseController be defined something like:

class Admin::BaseController < ActionController::Base
end

(< ActionController::Base being the key part there)

-Nick

My apologies. BaseController is defined

class Admin::BaseController < ApplicationController
end

ApplicationController is as it always is:

class ApplicationController < ActionController::Base
end

Nick S. wrote:

Shouldn’t the BaseController be defined something like:

class Admin::BaseController < ActionController::Base
end

(< ActionController::Base being the key part there)

-Nick

Ok just checking…been there done that one on my own :slight_smile:

Unfortunatly I’m not sure what the problem is then. I have an app with
this same type of setup with a bunch of controllers under the admin
module/directory.

Guessing you generated them by: ruby script/generate controller "admin/some_controller"?

What happens when you do the above with a default index action and you
try to view it (dont change it at all)? Same error?

-Nick