[Ruby-activeldap-discuss] error starting out

Kouhei Sutou kou at cozmixng.org
Sat Dec 29 07:52:28 EST 2007


Hi,

In <4775F76B.2090702 at dgrmm.net>
  "Re: [Ruby-activeldap-discuss] error starting out" on Sat, 29 Dec 2007 01:29:47 -0600,
  David Morton <mortonda at dgrmm.net> wrote:

> >> I have a hierarchy of  data, so there's obviously a has_many relation as
> >> you go down each branch in the tree.
> >>
> >> I have belongs_to working to go up the tree, but has_many is giving me
> >> fits.  There's no "list" of members in the subtree, it just needs to
> >> match all the submembers.  All sub members should have an attribute that
> >> indicates they belong to the group (which is how the belongs_to works). 
> >> How do I specify it?  The docs seem to say:
> >>     
> >
> > Could you show us an example situation with sample data?
> >
> >   
> (I'm reading docs from: http://ruby-activeldap.rubyforge.org/doc/)

Thanks. I've updated.

> Well, here's a contrived example similar to what I'm doing: (assume ldap
> schema has been created and is working... I haven't actually tested this
> code, but it's very similar)

> class User < ActiveLdap::Base
>   ldap_mapping :dn_attribute => 'user', :prefix => '', :classes => ['user']
>   belongs_to :group, :class => 'Group', :many => 'group', :foreign_key
> => 'group'
> end

> As it is, I get nil or empty errors. In the ldap debug log, I'm seeing
> some weird searches:
> 
> (&(group=group=test,dc=example,dc=com)(objectClass=user))

Thanks for showing. What about that? (group -> groups)

  class User < ActiveLdap::Base
    ...
    belongs_to :groups, :class => 'Group', :many => 'group', :foreign_key => 'group'
  end


Thanks,
--
kou


More information about the Ruby-activeldap-discuss mailing list