From: Glen Holcomb Date: 2009-10-30T05:29:09+09:00 Subject: Re: Net LDAP problem (no attrs or get_attributes methods) --000325557516498834047718c3b6 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On Thu, Oct 29, 2009 at 1:54 PM, Michael Linfield w= rote: > > > The docs say string or array of strings. Tried it with :attributes =3D= > > > [] > > and I get the same error. I also tried reinstalling the gem but that > > didn't > > help. > > What gem are you using? ruby-net-ldap? via require 'net/ldap'? > Might help to post more of your code so I can understand the whole > picture of things... > > p entry.attrs is invalid as it isn't a method per'se... hence the > NoMethodError. > attrs is like you said a string or array of strings. > > It should be used via connection.add("dc=3Dlocalhost, dc=3Dlocaldomain", > entry) > > Regards, > > - Mac > -- > Posted via http://www.ruby-forum.com/. > > Here is the code in its entirety: require 'rubygems' require 'net/ldap' ldap =3D Net::LDAP.new :host =3D> , :port =3D> 389, :auth =3D> { :method = =3D> :simple, :username =3D> "", :password =3D> "" } address_only_filter =3D Net::LDAP::Filter.pres("mailForwardingAddress") & ~(Net::LDAP::Filter.eq("mailDeliveryOption", "forward")) base =3D "ou=3DPeople,o=3Dcnm.edu,o=3Dcp" ldap.search(:base =3D> base, :scope =3D> Net::LDAP::SearchScope_WholeSubtre= e, :filter =3D> address_only_filter, :attributes =3D> "*") do |entry| p entry.dn p entry.attrs end I've removed the credentials and the host IP intentionally. Calling a specific attribute on the object works just fine. It just breaks when I tr= y to request all of them. I figured it would be the easiest way to ensure I only remove the attribute I'm interested in since not all records are sure to have the same attributes. --=20 "Hey brother Christian with your high and mighty errand, Your actions speak so loud, I can=92t hear a word you=92re saying." -Greg Graffin (Bad Religion) --000325557516498834047718c3b6--