out-cheat validates_uniqueness_of

before_save :strip_strings

     validates_uniqueness_of :username
     validates_presence_of :username
        
     private
     
     def strip_strings
         self.username = username.gsub!(" ","")
     end

example:

username = " gissmoh@gissmoh.de "

becomes gissmoh@gissmoh.de
and is stored in the datbase as gissmoh@gissmoh.de

"gissmoh @gissmoh. de"

becomes gissmoh@gissmoh.de
and is stored in the datbase as gissmoh@gissmoh.de

So I have duplicate entries!!

Jean-Etienne Durand schrieb:

use before_validation : strip_strings instead

before_save occurs before Base.save, but after the validation

Hit! It works!! Thanx...

I think there's still a lot to learn.....puuuuh!!!