ActiveLdap, belongs_to, and "invalid filter syntax"

After I started using :adapter => 'net_ldap' in ActiveLdap, my belongs_to associations all broke with when constructing a search filter with Net::LDAP

invalid filter syntax (Net::LDAP::LdapError)

The classes look something like this:


 class Person  'uid', :prefix => 'ou=people', 
       :classes => ['top', 'mozillaAddressBookEntry']
   belongs_to :family, :class => 'Family', 
      :foreign_key => 'dn', :primary_key => 'member'
 end
 
 class Family  'uid', :prefix => 'ou=families', 
       :classes => ['top','family', 'mozillaAddressBookEntry']
   has_many :people, :class => 'Person', 
      :wrap => 'member', :primary_key => 'dn'
 end
 

As I found out per this thread, Ruby Net::LDAP apparently can’t handle search filters with “=” or “,” characters, and doesn’t allow escaping with “\3D” or the like.

I switched back to the default Ruby/LDAP adapter, and the belongs_to associations work as expected.

Leave a comment

Leave a comment