Modules, controllers and inheritance


#1

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?


#2

I’ll try and have a look at this tonight. Which version of Rails are
you running (Edge vs. 1.0?) and do you have the latest engine plugin
(or the edge branch, in the case of using Edge rails)?

  • james

#3

On 30/01/06, James A. removed_email_address@domain.invalid wrote:

I’ll try and have a look at this tonight. Which version of Rails are
you running (Edge vs. 1.0?) and do you have the latest engine plugin
(or the edge branch, in the case of using Edge rails)?

I am running stable versions of Rails and plugins, pulled using
following svn:externals:

vendor:
rails http://dev.rubyonrails.org/svn/rails/branches/stable

vendor/plugins:
engines https://opensvn.csie.org/rails_engines/plugins/engines
login_engine https://opensvn.csie.org/rails_engines/plugins/login_engine
user_engine https://opensvn.csie.org/rails_engines/plugins/user_engine

Thanks in advance,