title: Proper way to validate password
body: <p>I have a user registration page. I want user password to be from 4 to 16 symbols. I need to check that they have at least one uppercase letter and 1 digit. Than I am making md5 hash of this password and put it into database.<br>
  How do I validate it?<br>
  Validation in model tests if password is 32symbols length: </p>
  
  <pre><code>  validates :password, :length =&gt; { :minimum =&gt; 32 , 
              :message =&gt; 'Not an md5 password provided.' }
  </code></pre>
  
  <p>But how do I validate that password matches my requirements before making a hash of it and set appropriate errors for this validation?<br>
  I would like view to get user.errors[:password] containing something like 'Must have at least one digit.' and 'Must have at least one uppercase letter.'</p>