Hi Francis, yes, it was missing the require 'net/ldap', thanks for the tip. I tried it in irb but forgot to put it in the controller. I have to read up alittle bit about net::ldap as Im not getting the appropriate credentials. Im getting results below in irb. Is there an example I can use to test out an example to test out a schema?
irb(main):023:0> require 'net/ldap' => true irb(main):024:0> ldap = Net::LDAP.new :host => 'solar', irb(main):025:0* :port => 389, irb(main):026:0* :auth => { irb(main):027:1* :method => :simple, irb(main):028:1* :username => "cn=manager,dc=example,dc=com", irb(main):029:1* :password => "opensesame" irb(main):030:1> } => #<Net::LDAP:0x2c35148 @base="dc=com", @open_connection=nil, @auth={:username=
"cn=manager,dc=example,dc=com", :password=>"opensesame", :method=>:simple}, @en
cryption=nil, @verbose=false, @port=389, @host="solar"> irb(main):031:0> irb(main):032:0* filter = Net::LDAP::Filter.eq( "cn", "George*" ) => #<Net::LDAP::Filter:0x2c265bc @left="cn", @op=:eq, @right="George*"> irb(main):033:0> treebase = "dc=example,dc=com" => "dc=example,dc=com" irb(main):034:0> irb(main):035:0* ldap.search( :base => treebase, :filter => filter ) do |entry|
irb(main):036:1* puts "DN: #{entry.dn}" irb(main):037:1> entry.each do |attribute, values| irb(main):038:2* puts " #{attribute}:" irb(main):039:2> values.each do |value| irb(main):040:3* puts " --->#{value}" irb(main):041:3> end irb(main):042:2> end irb(main):043:1> end => false irb(main):044:0> irb(main):045:0* p ldap.get_operation_result #<OpenStruct message="Invalid Credentials", code=49>