2012-06-13 102 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}」

相關問題