Validations over hashed password

I have this method in user.rb that automatically converts password to
SHA1 hash

def password=(value)
    write_attribute("password", Digest::SHA1.hexdigest(value))

but my user model validations dont seem to work properly…for example
length_of and confirmation_of… cause it gets SHA1 and stuff…

how do I keep it encrypted yet keep validations too?

if I remove the above mentioned method, it works fine but I risk the
password being naked :confused:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs