[Rails] Modules, controllers and inheritance

Łukasz Piestrzeniewicz bragi.ragnarson at gmail.com
Mon Jan 30 14:56:03 GMT 2006


Hi!

I was trying to cleanup my app and I runned into quite a problem. My
controllers in submodule do not seem to inherit things from base
class.

I have following setup:

app/controllers/
  application.rb:
    class ApplicationController
  admin/
    admin_controller.rb:
      class Admin::AdminController < ApplicationController
        include LoginEngine
        include UserEngine
        before_filter :authorize_action # method defined by LoginEngine
    homepage_controller.rb
      class Admin::HomepageController < Admin::AdminController

Now when I try to access HomepageController I get NoMethodError:

undefined method `authorize_action' for #<Admin::HomepageController:0xb77746c0>

So it seems that HomepageController properly inherits filters but not
included module contents.

Funny thing is that when I include engines from within
ApplicationController everything is a-ok.

Can someone tell me what is wrong?

--
Łukasz Piestrzeniewicz


More information about the Rails mailing list