0

このエラーが発生します:

12行目の初期化されていない定数OU(NameError)

私は何が間違っているのですか?

require 'win32ole'
domain = "dc=Troptrain,dc=net,dc=au"
ou = "studentsOU"

ad = WIN32OLE.connect("LDAP://#{OU}, #{domain}'")        # <== (line 12)
def errorcheck
  puts "Please enter the file name and location"
  file = gets.chomp.to_s
  #open file
  f1 = File.open(file,"r")
  #setup loop
  f1. each do |line|
    #split information
    info = line.split(',')
    #get informatio position 
    firstname = info[0]
    lastname = info[1]
    dob = info[2]
    snumber = info[3]
    eos = info[4]
    sarea = info[5]

    if ((firstname == ''))
      puts "No firstname found."
      puts ""
      system "pause"
      next
    end
4

1 に答える 1

3

Rubyでは大文字と小文字が区別されます。「#{OU}」を「#{ou}」に変更します

于 2012-06-13T04:50:04.800 に答える