Luke Abbey
Luke Abbey

Reputation: 31

Ruby, uninitialized constant

I'm getting this error:

uninitialized constant OU (NameError) on line 12

What am I doing wrong?

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

Upvotes: 0

Views: 1696

Answers (1)

Alex Blakemore
Alex Blakemore

Reputation: 11896

Ruby is case sensitive. Change "#{OU}" to "#{ou}"

Upvotes: 3

Related Questions