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.
9046f1681dc8375fd81b34799d5abd36?d=identicon&s=25 Jeff Smick (Guest)
on 2005-12-28 01: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?
Cb610750ee94ca103aef4b2dc7b1b768?d=identicon&s=25 Nick Stuart (Guest)
on 2005-12-28 15: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
9046f1681dc8375fd81b34799d5abd36?d=identicon&s=25 Jeff Smick (sprsquish)
on 2005-12-28 20:52
My apologies. BaseController is defined

class Admin::BaseController < ApplicationController
end

ApplicationController is as it always is:

class ApplicationController < ActionController::Base
end


Nick Stuart wrote:
> Shouldn't the BaseController be defined something like:
>
> class Admin::BaseController < ActionController::Base
> end
>
> (< ActionController::Base being the key part there)
>
> -Nick
Cb610750ee94ca103aef4b2dc7b1b768?d=identicon&s=25 Nick Stuart (Guest)
on 2005-12-28 21: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.