2012-06-13 46 views
0

我得到这个错误:红宝石,未初始化不断

uninitialized constant OU (NameError) on line 12

我在做什么错?

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 

回答

3

Ruby区分大小写。将“#{OU}”更改为“#{ou}”