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