# File lib/activeldap/base.rb, line 127
    def Base.create_object(config={})
      # Just upcase the first letter of the new class name
      str = config[:class]
      class_name = str[0].chr.upcase + str[1..-1]

      attr = config[:dnattr] # "uid"
      prefix = config[:base] # "ou=People"
      # [ 'top', 'posixAccount' ]
      classes_array = config[:classes] || []
      # [ [ :groups, {:class_name => "Group", :foreign_key => "memberUid"}] ]
      belongs_to_array = config[:belongs_to] || []
      # [ [ :members, {:class_name => "User", :foreign_key => "uid", :local_key => "memberUid"}] ]
      has_many_array = config[:has_many] || []

      raise TypeError, ":objectclasses must be an array" unless classes_array.respond_to? :size
      raise TypeError, ":belongs_to must be an array" unless belongs_to_array.respond_to? :size
      raise TypeError, ":has_many must be an array" unless has_many_array.respond_to? :size

      # Build classes array
      classes = '['
      classes_array.map! {|x| x = "'#{x}'"}
      classes << classes_array.join(', ')
      classes << ']'

      # Build belongs_to
      belongs_to = []
      if belongs_to_array.size > 0
        belongs_to_array.each do |bt|
          line = [ "belongs_to :#{bt[0]}" ]
          bt[1].keys.each do |key|
            line << ":#{key} => '#{bt[1][key]}'"
          end
          belongs_to << line.join(', ')
        end
      end

      # Build has_many
      has_many = []
      if has_many_array.size > 0
        has_many_array.each do |hm|
          line = [ "has_many :#{hm[0]}" ]
          hm[1].keys.each do |key|
            line << ":#{key} => '#{hm[1][key]}'"
          end
          has_many << line.join(', ')
        end
      end

      self.class.module_eval "class ::\#{class_name} < ActiveLDAP::Base\nldap_mapping :dnattr => \"\#{attr}\", :prefix => \"\#{prefix}\", :classes => \#{classes}\n\#{belongs_to.join(\"\\n\")}\n\#{has_many.join(\"\\n\")}\nend\n"
    end