[Ruby-activeldap-discuss] Integer attribute where nil should be valid

Ted Lepich tlepich at verizon.net
Fri Aug 29 20:02:24 EDT 2008


First of all thanks for all the hard work on this gem.  I'm in the final 
stages of converting my rails sqlite based app over to open ldap (75+ 
models) and the activeldap gem has been working great!  I'll probably be 
shooting off a few emails with questions on some challenges I'm having 
and some work around that I've done.  Here's the first one:

One item that I have run in to is validation on integer fields.  I have 
a number of integer attributes in my schema where nil is a valid 
condition, for example a user could set x=5 and then go back and un-set 
it.  When these attributes are submitted through the rails app to 
active-ldap they fail the validation for valid integer.

To get around this issue I've modified the validate_normalized_value 
method in the Integer class found in syntaxes.rb to treat blank as 
valid.  This seems to be working as expected - when nil is sent to 
openldap for an integer attribute the attribute is removed from the 
entry, which is perfect for me.  I'd appreciate any feedback on this 
approach and also like to know what others are doing for cases like this?

NOTE: I haven't checked all other types, but char and DN seem to work 
fine with nil

thanks,
ted



More information about the Ruby-activeldap-discuss mailing list