我收到了这个错误:
第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
答案 0 :(得分:3)
Ruby区分大小写。将“#{OU}”更改为“#{ou}”