Modules/Mixins and accessing the calling object?

Hello there,

I am stuck at a problem regarding modules here. I have a module that’s
included in my model and I need to get to know the class name of my
model from within the module. Problem is, that “self” is always
pointing to the module class (at least I think so) and I do not know
how to access the calling object.

Here’s the code:

module ActiveRecord
module Acts
module AclControlled
def self.included(base)
base.send :extend, InstanceMethods
base.send :extend, ClassMethods
end

  module InstanceMethods
    def controlled_object
      Rails.logger.info "Fetching ControlledObject..."
      controlled_object = ControlledObject.find

(:first, :conditions => {:model => self.class.to_s, :model_id =>
self.id })
end
end

  [...]
end

end
end
ActiveRecord::Base.send :include, ActiveRecord::Acts::AclControlled

Does anyone know how to get access to the calling object here? I tried
the super object too, but this seems to point to the model without the
mixin somehow.

Thanks in advance

Arne

Have to close this one, as it was my fault. Didn’t notice that some of
the methods I want to call are bound to classes rather than objects
and of course I tested with the wrong ones. Sorry guys, but thanks
again for your attention :slight_smile:

Cheers

Arne

On 14 Jan., 14:02, Arne-Kolja Bachstein