# File lib/activeldap/associations.rb, line 22
     def ldap_mapping(options = {})
       # The immediate ancestor should be the caller....
       klass = self.ancestors[0]

       dnattr = options[:dnattr] || 'cn'
       prefix = options[:prefix] || "ou=#{klass.to_s.split(':').last}"
       classes_array = options[:classes] || nil
       scope = options[:scope] || 'super'
       # When used, instantiates parent objects from the "parent dn". This
       # can be a String or a real ActiveLDAP class. This just adds the helper 
       # Base#parent.
       parent = options[:parent_class] || nil

       classes = 'super'
       unless classes_array.nil?
         raise TypeError, ":classes must be an array" \
           unless classes_array.respond_to? :size
         # Build classes array
         classes = '['
         classes_array.map! {|x| x = "'#{x}'"}
         classes << classes_array.join(', ')
         classes << ']'
       end

       # This adds the methods to the local
       # class which can then be inherited, etc
       # which describe the mapping to LDAP.
       klass.class_eval("class << self\n# Return the list of required object classes\ndef required_classes\n\#{classes}\nend\n\n# Return the full base of the class\ndef base\nif \"\#{prefix}\".empty?\nreturn \"\\\#{super}\"\nelse\nreturn \"\#{prefix},\\\#{super}\"\nend\nend\n\n# Return the expected DN attribute of an object\ndef dnattr\n'\#{dnattr}'\nend\n\n# Return the expected DN attribute of an object\ndef ldap_scope\n\#{scope}\nend\nend\n\n# Hide connect\nprivate_class_method :connect\n\n# Unhide class methods\npublic_class_method :find_all\npublic_class_method :find\npublic_class_method :new\npublic_class_method :dnattr\n")

      # Add the parent helper if desired
      if parent
        klass.class_eval("def parent()\nreturn \#{parent}.new(@dn.split(',')[1..-1].join(','))\nend\n")
      end
     end