Forum: Ruby on Rails Module loading

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jeff S. (Guest)
on 2005-12-28 02:00
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?
Nick S. (Guest)
on 2005-12-28 16:22
(Received via mailing list)
Shouldn't the BaseController be defined something like:

class Admin::BaseController < ActionController::Base
end

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

-Nick
Jeff S. (Guest)
on 2005-12-28 21:52
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
Nick S. (Guest)
on 2005-12-28 22:02
(Received via mailing list)
Ok just checking...been there done that one on my own  :)

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
This topic is locked and can not be replied to.