ruby version of AID database handling