Because rails clears the errors during save, I can't do this in my model:
def password= plain_text
if plain_text =~ /\d/ && plain_text =~ /\w/
self.password_digest = BCrypt::Password.create(plain_text)
else
self.errors[:password] = "must contain one digit and one word character."
end
end
What's the best way to validate a password to have one letter and one digit in rails, while still using bcrypt?