Problem with mixins and filters

Hi all,

I am stumped with the following problem:

  • A module, which is mixed into a controller, defines two methods, ‘a’
    and ‘b’
  • ‘a’ calls ‘b’
  • ‘b’ might be overriden in the controller
  • when ‘a’ is called as a ‘before_filter’, it always calls the version
    of ‘b’ defined in the mixin module, regardless of whether the controller
    defines its own ‘b’.
  • when ‘a’ is called as an action, it correctly invokes the ‘right’
    version of ‘b’.

For example:

module A
def a
b
end

def b
puts “A.b called”
end
end

class FooController < ApplicationController
include A

before_filter :a

def b
puts “C.b called”
end
end

I’m at a loss. Could anyone toss me a clue? Thanks!

Brian

Brian H. wrote:

Never mind. I had another problem which mislead me; the example I gave
works perfectly once I correct the other problem.

Hi all,

I am stumped with the following problem:

  • A module, which is mixed into a controller, defines two methods, ‘a’
    and ‘b’
  • ‘a’ calls ‘b’
  • ‘b’ might be overriden in the controller
  • when ‘a’ is called as a ‘before_filter’, it always calls the version
    of ‘b’ defined in the mixin module, regardless of whether the controller