Hi, It is strange because in the first time that I use this function all is ok and in the second some times this return the value twofold. def self.getDirPath(parent_id) if nil == parent_id or 1 == Integer(parent_id) return ''./public/medias/'' else parent = Media.find_by_id(parent_id) dirpath = '''' while nil != parent dirpath = parent.file + ''/'' + dirpath parent = Media.find_by_id(parent.parent_id) end return ''./public/'' + dirpath end end More one think. How do you debug in rubyonrails?? Thank you. -- Pedro C. Valentini pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org +55 (21) 8708-8035