[Ruby-activeldap-discuss] return type of 'find' method?
Kouhei Sutou
kou at cozmixng.org
Wed May 2 19:33:40 EDT 2007
Hi,
In <2af793440705021619u19fdf911y6eec5e8f12fdfa2a at mail.gmail.com>
"Re: [Ruby-activeldap-discuss] return type of 'find' method?" on Wed, 2 May 2007 16:19:51 -0700,
"Reid Wightman" <krwightm at gmail.com> wrote:
> Grin, stupid web browser as an editor, hitting tab is not a very good idea when
> the first button it highlights is "send" :).
>
> Anyway...
>
> I run the code below::
>
> require 'rubygems'
> require_gem 'log4r'
> require_gem 'ruby-activeldap'
>
> class User < ActiveLdap::Base
> ldap_mapping
> end
>
> ActiveLdap::
>
> Base.establish_connection(
> :host=>"dir.spawar.navy.mil",
> :port=>389,
>
> :base=>"ou=People,ou=SPAWAR,ou=Navy,ou=DoD,o=
> U.S. Government,c=US")
>
> u = User.find(:attribute => "uid",:value => "reidkr")
>
> My variable 'u' is of type 'nil' after my assignment. When I run the same
> query with ldapsearch I get precisely one record returned to me. Indeed, when
> I run this program and watch my ethernet device, I see the query go out, and a
> response come back with my complete user entry (as well as a bunch of other
> junk that I guess is ldap format information).
How about the following?
class User < ActiveLdap::Base
ldap_mapping :dn_attribute => "uid", :prefix => ""
end
u = User.find("reidkr")
Or
class User < ActiveLdap::Base
ldap_mapping :dn_attribute => "uid", :prefix => "ou=People"
end
ActiveLdap::Base.establish_connection(...,
:base=>"ou=SPAWAR,ou=Navy,ou=DoD,o=U.S. Government,c=US")
u = User.find("reidkr")
Thanks,
--
kou
More information about the Ruby-activeldap-discuss
mailing list