I have some modules that will be included in my controller classes. These modules define before_filter :
module BasicFeatures def filter_method ... end def self.included(base) base.before_filter(:filter_method) ... end end module AdvancedFeatures include BasicFeatures ... end
And classes:
class BasicController < ApplicationController include BasicFeatures end class AdvancedController < ApplicationController include AdvancedFeatures end
- When the
BasicFeatures module BasicFeatures included in the AdvancedFeatures module, it does not have before_filter methods. AdvancedController did not receive a call before_filter .
I need both of my controllers to get before_filter without duplicating code. I do not know if I am using the best approach, so I am open to any suggestion.
source share