Hi,
I am trying to use ActiveLdap for authentication in my rails app. But I
am running into a problem with the "belongs_to" and "has_many"
associations.

Here ist how my models look like.

class Person < ActiveLdap::Base
  ldap_mapping :dn_attribute => "uid",
               :prefix => "ou=People",
               :classes => ['top', 'account', 'posixAccount']
  belongs_to :groups, :class => 'Group', :many => 'memberUid'
end

class Group < ActiveLdap::Base
  ldap_mapping :dn_attribute => "cn",
                            :prefix => "ou=Group",
                            :classes => ['posixGroup','top']
  has_many :member, :class => "Person", :wrap => "memberUid"
end

According to ActiveLdap documentation I am testing the association.

irb> me = User.find('aebel')
irb> me.groups.each { |group| p group.cn };nil
"develop"
"wheel"
=> nil

So far everything works fine. But when I try to do a membership test, it
fails.

irb> me.groups.member? 'wheel'
=> false

My environment:
Rails 2.2.2
AciveLdap SVN revision 802

Any help will be appreciated
Alexander Ebel
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to